# Create a document `POST /api/v1/documents` Creates a document. ## 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. ## 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, required) — Document number, up to 50 characters. - `released_at` (integer or date string, required) — Issue date, as Unix seconds or an ISO date. - `expires_at` (integer or date string, required) — 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. Supply one subject ID such as `athlete_id`, or send both `belongs_to` and `belongs_obj_id`. ## Request 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" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"athlete_id":42,"doc_number":"DOC-DEMO-001","released_at":1788220800,"expires_at":1819756800,"got_paper":true,"name":"Registration consent"}' ``` ## Response **201 Created** The created document is returned in data. Example with fictional data and selected fields. ```json { "message_key": "entities.document.messages.created", "data": { "id": 31, "sport_id": 3, "belongs_to": "athlete", "belongs_obj_id": 42, "name": "Registration consent", "doc_number": "DOC-DEMO-001", "released_at": 1788220800, "expires_at": 1819756800, "is_medical": false, "got_paper": true, "url": null, "notes": "Paper copy received." } } ``` ## Errors - `401` — The API key is missing or invalid. - `403` — The API key lacks the required permission. - `409` — The file is still processing. - `422` — One or more fields failed validation. - `500` — The record or attachment association could not be saved.