# Update a document `PATCH / PUT / POST /api/v1/documents/{id}` Updates a document by ID. ## Permissions Send your API key in `X-API-Key`. Required permissions are **Documents → Write**. ## Headers - `X-Sport-Id` (integer, required) — The sport ID from [List sports](/api/sports/list.md). Use the sport the record belongs to. ## Path parameters - `id` (integer, required) — ID of the document. ## Body parameters - `name` (string) — Display name, up to 50 characters. Defaults to Document on creation. - `belongs_to` (string) — Subject type. Use athlete, coach, staff, or parent. - `belongs_obj_id` (integer) — ID of the subject named by belongs_to. - `athlete_id` (integer) — ID of the athlete in the selected sport. - `coach_id` (integer) — Assign the document to this coach. - `staff_id` (integer) — Assign the document to this staff member. - `doc_number` (string) — Document number, up to 50 characters. - `released_at` (integer or date string) — Issue date, as Unix seconds or an ISO date. - `expires_at` (integer or date string) — Expiration date, as Unix seconds or an ISO date. - `got_paper` (boolean) — Whether the club received a paper copy. - `notes` (string or null) — Notes, up to 200 characters. - `type` (string or null) — Document category, up to 20 characters. - `url` (string or null) — URL for an already-uploaded attachment. - `filetype` (string or null) — MIME type of the attachment. - `filesize` (integer or null) — Attachment size in bytes. Omitted fields keep their stored value. Use the remove-file endpoint to detach an existing attachment. ## Request (PATCH) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request PATCH \ --url "https://api.asdincloud.com/api/v1/documents/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"Updated registration consent"}' ``` ## Request (PUT) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request PUT \ --url "https://api.asdincloud.com/api/v1/documents/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"Updated registration consent"}' ``` ## Request (POST) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request POST \ --url "https://api.asdincloud.com/api/v1/documents/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"Updated registration consent"}' ``` ## Response **200 OK** Returns a successful update response. Example with fictional data and selected fields. ```json { "message_key": "entities.document.messages.updated" } ``` ## Errors - `401` — The API key is missing or invalid. - `403` — The API key lacks the required permission. - `404` — The requested record was not found. - `409` — The file is still processing. - `422` — One or more fields failed validation. - `500` — The record or attachment association could not be saved.