---
title: "Update a site"
description: "Update a site."
canonical: https://www.charitips.com/docs/api-reference/update-site
---

# Update a site

`PATCH /v1/sites/{siteId}`

Update a site.

**Authentication**: Bearer access token.

## Parameters

- `siteId` (string, required)

## Body

- `subdomain` (string): Subdomain to register. Required if customDomain not provided.
- `customDomain` (string): Custom domain to register. Required if subdomain not provided.
- `accountId` (string, UUID): Only required to link the created entity to a child account instead of the current one.

## Response 200

- `siteId` (string, required)
- `subdomain` (string)
- `customDomain` (string)
- `accountId` (string, required)
- `createdAt` (string (date-time), required)
- `updatedAt` (string (date-time), required)

## Errors

- 400 `Invalid customDomain`: A custom domain cannot contain a Charitips domain (charitips.com, charitips.net, charitips.org, charitips.tech, chari.tips). Use a domain you own, or `subdomain` for an address under Charitips. See https://www.charitips.com/docs/api-reference/create-site.md.
- 400 `A field is missing, has the wrong type, or is not part of the request schema.`: `message` lists every problem. Unknown fields are rejected, not ignored: remove them rather than sending extra data. See https://www.charitips.com/docs/api-reference/errors.md.
- 401 `Unauthorized`: The access token is missing, expired or invalid. Create a new one with your client id and secret, send it as `Authorization: Bearer <accessToken>`, then retry once. Sandbox tokens only work on api.sandbox.charitips.com. See https://www.charitips.com/docs/get-started/authentication.md.
- 402 `Plan upgrade required`: Your plan does not include this feature. Upgrade the plan from the dashboard, then retry. See https://www.charitips.com/docs/overview/plans.md.
- 403 `Subdomain can't be updated`: Accounts with account hierarchycannot change a site's subdomain here; `customDomain` can still be changed. For a child account, the parent sets the subdomain with update-account. See https://www.charitips.com/docs/api-reference/update-account.md.
- 403 `Account closed`: The account behind these credentials is closed: no token is issued and every call is refused, reads included. Contact Charitips to reopen it. See https://www.charitips.com/docs/api-reference/troubleshooting.md#calls-answer-403-account-not-active-account-not-validated-or-account-closed.
- 403 `Forbidden`: Your credentials cannot perform this action on this resource. An id from another account never answers 403: it is treated as unknown, with a 404 in the path or a 400 `Bad Request` in the body or the query. See https://www.charitips.com/docs/api-reference/errors.md.
- 404 `Not Found`: No resource with this id on your account and environment. An id that belongs to another account answers 404 too when it is in the path. Ids from the sandbox do not exist in production. See https://www.charitips.com/docs/get-started/sandbox.md.

## Example

```bash
curl -X PATCH https://api.sandbox.charitips.com/v1/sites/<siteId> \
  -H "Authorization: Bearer $CHARITIPS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "subdomain": "donations"
  }'
```

```javascript
const response = await fetch('https://api.sandbox.charitips.com/v1/sites/<siteId>', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.CHARITIPS_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "subdomain": "donations"
  }),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
const data = await response.json();
```

```python
import os, requests

response = requests.patch(
    "https://api.sandbox.charitips.com/v1/sites/<siteId>",
    headers={"Authorization": f"Bearer {os.environ['CHARITIPS_TOKEN']}"},
    json={
      "subdomain": "donations"
    },
)
response.raise_for_status()
data = response.json()
```

## Response example (200, placeholder values)

```json
{
  "siteId": "<siteId>",
  "subdomain": "<subdomain>",
  "customDomain": "<customDomain>",
  "accountId": "<accountId>",
  "createdAt": "<createdAt>",
  "updatedAt": "<updatedAt>"
}
```
