> Documentation index: https://beezr.io/developers/api/llms.txt

# Update a record

`POST /api/v1/records/update`

Changes only the fields you send. Returns the record as it is after the update. Send an `Idempotency-Key` to make retries safe.

If the re-read fails, the result contains only the record id.

## Requirements

| Requirement | Value |
| --- | --- |
| Auth | `X-API-Key` |
| Counts as | 1 request |
| Idempotency | supported |
| Batch limit | n/a |
| Files | up to 10 MB each |

## Headers

| Parameter | Type | Presence | Description |
| --- | --- | --- | --- |
| `X-API-Key` | string | required | Read from your server environment. |
| `Content-Type` | string | required | `application/json`. |
| `Idempotency-Key` | string | optional | 1 to 128 visible ASCII characters. Repeat the same request with the same key and Beezr returns the first result instead of running it again (header `Idempotency-Replayed: true`). |

## Body parameters

| Parameter | Type | Presence | Description |
| --- | --- | --- | --- |
| `module` | string | required | The module's table name, shown under the module name on its card in Beezr Designer (for example `cm_equipment_requests_base`). |
| `id` | integer | required | Minimum 1. |
| `data` | object | required | Field values keyed by each field's System name (Designer → module → Fields). Lookup, relation and user fields take the id of the chosen item. File fields take a FileUpload object (or an array for multi-file fields). Fields not in the module are ignored.  |
| `data.<file-field>.fileName` | string | required | — |
| `data.<file-field>.contentType` | string | optional | Informational |
| `data.<file-field>.data` | string | required | Base64 file bytes |

## Returns

HTTP 200. Updated. `data` is the record after the update.

| Parameter | Type | Presence | Description |
| --- | --- | --- | --- |
| `success` | boolean | optional | — |
| `data` | object | optional | A record. `id` is the record id; every other property is a field keyed by its System name. |
| `data.id` | integer | optional | — |

Field values come back in the same form the Designer shows them.

## Errors

| HTTP | Code | What to do |
| --- | --- | --- |
| 400 | [`MISSING_REQUIRED_FIELD`](/developers/api/errors/#missing-required-field) | Send the required body fields. |
| 400 | [`INVALID_DATA`](/developers/api/errors/#invalid-data) | Check field System names. |
| 400 | [`INVALID_IDEMPOTENCY_KEY`](/developers/api/errors/#invalid-idempotency-key) | Send one visible ASCII key, 1–128 characters. |
| 400 | [`KEY_FIELD_UNRESOLVED`](/developers/api/errors/#key-field-unresolved) | Check the module key field. |
| 401 | [`AUTHENTICATION_FAILED`](/developers/api/errors/#authentication-failed) | Check the API key. |
| 404 | [`MODULE_NOT_FOUND`](/developers/api/errors/#module-not-found) | Copy the module table name. |
| 409 | [`IDEMPOTENCY_KEY_REUSED`](/developers/api/errors/#idempotency-key-reused) | Keep the original body. |
| 409 | [`IDEMPOTENCY_IN_PROGRESS`](/developers/api/errors/#idempotency-in-progress) | Wait Retry-After: 2. |
| 409 | [`IDEMPOTENCY_RESULT_UNKNOWN`](/developers/api/errors/#idempotency-result-unknown) | Reconcile before new work. |
| 400 | [`INVALID_CONTENT_PAYLOAD`](/developers/api/errors/#invalid-content-payload) | Send a file object with fileName and data. |
| 400 | [`CONTENT_DECODE_FAILED`](/developers/api/errors/#content-decode-failed) | Send valid base64 in data. |
| 400 · 413 | [`CONTENT_TOO_LARGE`](/developers/api/errors/#content-too-large) | Keep files within 10 MB. |
| 429 | [`RATE_LIMIT_EXCEEDED`](/developers/api/errors/#rate-limit-exceeded) | Wait for the rate-limit reset. |
| 429 | [`TOO_MANY_CONCURRENT_REQUESTS`](/developers/api/errors/#too-many-concurrent-requests) | Wait; keep at most 2 in flight. |
| 429 | [`MONTHLY_QUOTA_EXCEEDED`](/developers/api/errors/#monthly-quota-exceeded) | Stop retries until the 1st. |
| 409 · 422 · 500 | [`UPDATE_FAILED`](/developers/api/errors/#update-failed) | 409 duplicate key · 422 rule or plan limit, fix the data · 500 retry once. |
| 500 | [`FIELD_LOAD_FAILED`](/developers/api/errors/#field-load-failed) | Retry later. |
| 500 | [`INTERNAL_ERROR`](/developers/api/errors/#internal-error) | Retry later. |

## Request

```curl
curl --fail-with-body --silent --show-error \
  'https://services.beezr.io/generic/api/v1/records/update' \
  -H "X-API-Key: $BEEZR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
  "module": "cm_equipment_requests_base",
  "id": 482913,
  "data": {"priority":1}
}'
```

```javascript
const response = await fetch("https://services.beezr.io/generic/api/v1/records/update", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.BEEZR_API_KEY,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "module": "cm_equipment_requests_base",
    "id": 482913,
    "data": {"priority":1}
  })
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

```python
import os
import requests

response = requests.post(
    "https://services.beezr.io/generic/api/v1/records/update",
    headers={"X-API-Key": os.environ["BEEZR_API_KEY"]},
    json={
      "module": "cm_equipment_requests_base",
      "id": 482913,
      "data": {"priority":1}
    }
)
response.raise_for_status()
print(response.json())
```

## Success response

```json
{
  "success": true,
  "data": {"id":482913,"title":"Laptop"}
}
```

## Common error

```json
{"success":false,"error":{"code":"AUTHENTICATION_FAILED","message":"Invalid or missing API key"}}
```
