---
title: "Replace an organization's billing details"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Billing API › Billing

`PUT /v1/organizations/{orgId}/billing-preferences`

## Authentication

Requires one of the following:

- `apiKey`, http, header `Authorization`
- `oauth`, http, header `Authorization`
- `sessionCookie`, apiKey, in cookie

## Path parameters

- `UpdateBillingPreferences.path.orgId` (string, required)
  - format `uuid`

## Request body

_Required._

- `UpdateBillingPreferences.contact` (object, required)
  - `UpdateBillingPreferences.contact.name` (string, required)
    - minLength 1; maxLength 200
  - `UpdateBillingPreferences.contact.email` (string, required)
    - format `email`; maxLength 254
  - `UpdateBillingPreferences.contact.phone` (string | null, optional)
    - maxLength 32
- `UpdateBillingPreferences.address` (object, required)
  - `UpdateBillingPreferences.address.line1` (string, required)
    - minLength 1; maxLength 200
  - `UpdateBillingPreferences.address.city` (string, required)
    - minLength 1; maxLength 100
  - `UpdateBillingPreferences.address.country` (string, required) — ISO 3166-1 alpha-2, case-insensitive; stored uppercase.
  - `UpdateBillingPreferences.address.line2` (string | null, optional)
    - maxLength 200
  - `UpdateBillingPreferences.address.region` (string | null, optional)
    - maxLength 100
  - `UpdateBillingPreferences.address.postalCode` (string | null, optional)
    - maxLength 20
- `UpdateBillingPreferences.billingMethod` (string, optional) — Default stripe.
  - one of `"stripe"`

## Example request

```json
{
  "contact": {
    "name": "string",
    "email": "user@example.com",
    "phone": "string"
  },
  "address": {
    "line1": "string",
    "line2": "string",
    "city": "string",
    "region": "string",
    "postalCode": "string",
    "country": "string"
  },
  "billingMethod": "stripe"
}
```

## Code samples

### cURL

```curl
curl --request PUT \
  --url https://billing.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/billing-preferences \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contact": {
    "name": "string",
    "email": "user@example.com",
    "phone": "string"
  },
  "address": {
    "line1": "string",
    "line2": "string",
    "city": "string",
    "region": "string",
    "postalCode": "string",
    "country": "string"
  },
  "billingMethod": "stripe"
}
'
```

### TypeScript

```typescript
const url = 'https://billing.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/billing-preferences';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    contact: {name: 'string', email: 'user@example.com', phone: 'string'},
    address: {
      line1: 'string',
      line2: 'string',
      city: 'string',
      region: 'string',
      postalCode: 'string',
      country: 'string'
    },
    billingMethod: 'stripe'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://billing.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/billing-preferences"

payload = {
    "contact": {
        "name": "string",
        "email": "user@example.com",
        "phone": "string"
    },
    "address": {
        "line1": "string",
        "line2": "string",
        "city": "string",
        "region": "string",
        "postalCode": "string",
        "country": "string"
    },
    "billingMethod": "stripe"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "organizationId": "string",
  "billingMethod": "string",
  "contact": {
    "name": "string",
    "email": "user@example.com",
    "phone": "string"
  },
  "address": {
    "line1": "string",
    "line2": "string",
    "city": "string",
    "region": "string",
    "postalCode": "string",
    "country": "string"
  },
  "updatedAt": "2019-08-24T14:15:22Z",
  "updatedBy": "string",
  "updatedByType": "string"
}
```

- `UpdateBillingPreferences.response.200.organizationId` (string, required)
- `UpdateBillingPreferences.response.200.billingMethod` (string, required)
- `UpdateBillingPreferences.response.200.contact` (one of, required)
  - one of: [BillingContact](/billing-api/schemas/BillingContact/), `null`
- `UpdateBillingPreferences.response.200.address` (one of, required)
  - one of: [BillingAddress](/billing-api/schemas/BillingAddress/), `null`
- `UpdateBillingPreferences.response.200.updatedAt` (string | null, required)
  - format `date-time`
- `UpdateBillingPreferences.response.200.updatedBy` (string | null, required) — Who last saved them: a user's or bot's ID.
- `UpdateBillingPreferences.response.200.updatedByType` (string | null, required) — user or bot.

### 400

invalid_request: the request is malformed (with issues), or invalid_cursor.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.400.error` (object, required)
  - `UpdateBillingPreferences.response.400.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.400.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.400.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.400.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.400.error.issues.message` (string, required)

### 401

unauthenticated: no valid credential.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.401.error` (object, required)
  - `UpdateBillingPreferences.response.401.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.401.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.401.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.401.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.401.error.issues.message` (string, required)

### 403

access_denied: the caller isn't allowed to (the message names the action); forbidden_origin: a cookie-authenticated write from another site.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.403.error` (object, required)
  - `UpdateBillingPreferences.response.403.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.403.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.403.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.403.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.403.error.issues.message` (string, required)

### 404

not_found: the organization (or one the caller doesn't belong to), or the resource, doesn't exist.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.404.error` (object, required)
  - `UpdateBillingPreferences.response.404.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.404.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.404.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.404.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.404.error.issues.message` (string, required)

### 409

invoice_in_progress: the organization's invoice is being issued; retry shortly.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.409.error` (object, required)
  - `UpdateBillingPreferences.response.409.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.409.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.409.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.409.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.409.error.issues.message` (string, required)

### 429

too_many_requests: slow down.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.429.error` (object, required)
  - `UpdateBillingPreferences.response.429.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.429.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.429.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.429.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.429.error.issues.message` (string, required)

### 500

internal_error: a bug; the details are in the logs, under the request ID.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.500.error` (object, required)
  - `UpdateBillingPreferences.response.500.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.500.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.500.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.500.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.500.error.issues.message` (string, required)

### 503

unavailable, ledger_unavailable or payments_unavailable: retry later.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdateBillingPreferences.response.503.error` (object, required)
  - `UpdateBillingPreferences.response.503.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdateBillingPreferences.response.503.error.message` (string, required) — What went wrong, for people.
  - `UpdateBillingPreferences.response.503.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdateBillingPreferences.response.503.error.issues.path` (string, required)
    - `UpdateBillingPreferences.response.503.error.issues.message` (string, required)


Source: https://docs.ezghcloud.com/billing-api/Billing/UpdateBillingPreferences/index.md
