# Update User Invoicing

> Update invoicing settings for a specific user

Source: https://docs.botsubscription.com/api/users/update-invoicing/

Update a customer's invoicing details for your Telegram or Discord subscription bot using an unrestricted project API key.

<ApiEndpoint method="PATCH" endpoint="/v2/projects/{project_id}/users/{user_id}/invoicing" />

<ApiAuthorization type="Bearer API Key" />

**API key access:** Unrestricted project API key required. Restricted keys cannot call this endpoint.

Supply an explicit `user_id`; the `me` alias is not supported by project API keys.

<ApiSection title="Path Parameters">
  <ApiParameter name="project_id" type="string" required description="The unique identifier of the project." />
  <ApiParameter name="user_id" type="string" required description="The user ID to update invoicing settings for." />
</ApiSection>

<ApiSection title="Request Body">
  <ApiParameter name="name" type="string" description="Full name for invoicing." />
  <ApiParameter name="email" type="string" description="Email address for invoicing." />
  <ApiParameter name="address" type="string" description="Street address." />
  <ApiParameter name="city" type="string" description="City name." />
  <ApiParameter name="region" type="string" description="State, province, or region." />
  <ApiParameter name="postal" type="string" description="Postal or ZIP code." />
  <ApiParameter name="country" type="string" description="Country code (e.g., US, GB)." />
  <ApiParameter name="vat_number" type="string" description="VAT registration number (for EU businesses)." />
</ApiSection>

<ApiSamplePane>

<ApiRequestSample title="Request">

```bash
curl -X PATCH "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/users/123456789012345678/invoicing" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "john@example.com",
    "address": "123 Main St",
    "city": "New York",
    "region": "NY",
    "postal": "10001",
    "country": "US"
  }'
```

```javascript
const project_id = 'YOUR_PROJECT_ID';
const user_id = '123456789012345678';
const response = await fetch(`https://api.botsubscription.com/v2/projects/${project_id}/users/${user_id}/invoicing`, {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'John Doe',
    email: 'john@example.com',
    address: '123 Main St',
    city: 'New York',
    region: 'NY',
    postal: '10001',
    country: 'US'
  })
});
const data = await response.json();
```

```python
import requests

project_id = 'YOUR_PROJECT_ID'
user_id = '123456789012345678'
response = requests.patch(
    f'https://api.botsubscription.com/v2/projects/{project_id}/users/{user_id}/invoicing',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'name': 'John Doe',
        'email': 'john@example.com',
        'address': '123 Main St',
        'city': 'New York',
        'region': 'NY',
        'postal': '10001',
        'country': 'US'
    }
)
data = response.json()
```

```php
$project_id = 'YOUR_PROJECT_ID';
$user_id = '123456789012345678';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.botsubscription.com/v2/projects/{$project_id}/users/{$user_id}/invoicing");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'address' => '123 Main St',
    'city' => 'New York',
    'region' => 'NY',
    'postal' => '10001',
    'country' => 'US'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
```

</ApiRequestSample>

<ApiResponseTabs>
  <ApiResponse status={200} description="Invoicing updated">

```json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "PATCH",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/users/123456789012345678/invoicing",
  "code": 200,
  "data": {
    "name": "John Doe",
    "email": "john@example.com",
    "address": "123 Main St",
    "city": "New York",
    "region": "NY",
    "postal": "10001",
    "country": "US",
    "vat_number": null,
    "state_code": "NY",
    "legal_consents": {
      "terms": {
        "version": "2026-01",
        "accepted_at": "2026-01-01T10:00:00.000Z"
      },
      "privacy": {
        "version": "2026-01",
        "accepted_at": "2026-01-01T10:00:00.000Z"
      }
    }
  }
}
```

  </ApiResponse>
  <ApiResponse status={404} description="User not found">

```json
{
  "ok": false,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "PATCH",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/users/123456789012345678/invoicing",
  "code": 404,
  "error": {
    "error_code": "NOT_FOUND",
    "message": "User not found"
  }
}
```

  </ApiResponse>
  <ApiResponse status={401} description="Invalid or expired API key">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "PATCH",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/users/123456789012345678/invoicing",
  "code": 401,
  "error": {
    "message": "Invalid or expired authentication token.",
    "error_code": "UNAUTHORIZED"
  }
}
```

  </ApiResponse>
</ApiResponseTabs>

</ApiSamplePane>
