# POST /api/v2/free-days

Create a free day

- MCP id: free-days.store
- Scope: api:write:free_days
- Permission: free_days::manage
- Rate cost: 1 unit, write bucket. A write costs the same whatever `view` you ask for.
- Cache-Control: private, no-store

Creates one free day and returns it with a `Location` header.

`description` is required and is not derived from `holiday_id`: for a holiday-derived day plnnrly copies the holiday name into it at creation time and the two drift independently, so send the label you want. Nothing enforces one free day per date: plnnrly's year generation skips an already-used date, but this endpoint does not, and a duplicate date is a plain `201`. To generate a year of free days from the recurring holidays, call this endpoint once per holiday.

## Parameters
- view (string, optional): Which field set to render.
- X-Request-Id (header, optional): A correlation id of your own. It is recorded in our logs next to the server's request id but never returned: the response header always carries the server's id. A value that does not match the pattern is discarded silently, never rejected.
- Idempotency-Key (header, optional): A caller-chosen key that makes this POST safe to retry. Replaying it returns the original response with Idempotency-Replayed: true.

## Request body
- description (string ≤ 255, required): Label for the free day, e.g. `Christmas Day`. For a holiday-derived day this is a copy of the holiday name taken when the free day was created, so renaming the holiday does not rewrite it.
- date (date (YYYY-MM-DD), required): Calendar date the organisation is closed.
- holiday_id (integer or null → Holiday.id, optional): Recurring holiday this free day instantiates, or `null` for a day added by hand. The foreign key nulls on delete, so removing the holiday leaves the free day behind as a manual day still carrying the copied label.

Unknown keys are refused with `422` validation-failed, naming the key.

## Response 201
- id (integer, required): Unique identifier.
- description (string ≤ 255, required): Label for the free day, e.g. `Christmas Day`. For a holiday-derived day this is a copy of the holiday name taken when the free day was created, so renaming the holiday does not rewrite it.
- date (date (YYYY-MM-DD), required): Calendar date the organisation is closed.
- holiday_id (integer or null, required): Recurring holiday this free day instantiates, or `null` for a day added by hand. The foreign key nulls on delete, so removing the holiday leaves the free day behind as a manual day still carrying the copied label.
- holiday (Ref or HolidaySummary or null, required): The recurring holiday this free day instantiates; absent for a manually added day.
- created_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Creation timestamp.
- updated_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Last-write timestamp; use for incremental sync.
- links (FreeDayLinks, required)
  - self (url, required): The canonical URI of this record.

## Errors
- 403 forbidden-by-policy | insufficient-permission | insufficient-token-scope: Forbidden.
- 409 idempotency-key-in-flight | idempotency-key-reused: Conflict.
- 415 unsupported-media-type: Unsupported media type.
- 422 unprocessable-relationship | validation-failed: Unprocessable content.
- 400 idempotency-key-required | invalid-cursor | invalid-query-parameter | malformed-request | unsupported-parameter: Bad request.
- 401 token-expired | unauthenticated: Unauthenticated.
- 404 endpoint-not-found | resource-not-found: Not found.
- 406 not-acceptable: Not acceptable.
- 429 rate-limit-exceeded: Too many requests.
- 500 internal-error: Server error.
- 503 tenant-unavailable: Service unavailable.

## Example
```bash
curl -X POST \
  'https://<your-url>/api/v2/free-days' \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: <key>' \
  -d '{
    "description": "Office closed for the annual outing",
    "date": "2026-07-03"
  }'
```
