---
title: "POST /api/grants"
method: POST
path: "/api/grants"
tags: ["grants"]
---

# POST /api/grants

`POST /api/grants`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - API key in cookie `sessionid`

Airtime grants: a window of airtime given to one organization, and the
list of what plays in it.

Members see their organizations' grants and replace a grant's list
while it is open (or until air, if it is exempt from locking). Staff
see every grant, create grants, and cancel or exempt them.

## Request body

- AirtimeGrantCreateRequest: Staff gives an organization a window of airtime directly.
  - `organization` integer, required
  - `starttime` string, date-time, required
  - `endtime` string, date-time, required
  - `locksAt` string, date-time: Defaults to the Monday 00:00 before the grant's week airs.
  - `lockExempt` boolean: Editable until air; every save after compiling recompiles it. Staff only.
  - `recipe` RecipeRequest, nullable: How a slot or a grant programs itself. Read, it describes the recipe. Written, it is a choice: the kind and what that kind needs. `uploads` (everything the owner uploads, new first, then the archive) needs nothing; `series` needs one of the owner's series; `jukebox` (staff only, the station's airtime) takes an optional theme: categories, shortest and longest length, and how new or old the videos may be.
    - `kind` 'uploads' | 'series' | 'playlist' | 'jukebox', required: * `uploads` - Everything the owner uploads * `series` - One of the owner's series * `playlist` - A list of videos * `jukebox` - The video jukebox
    - `series` integer, nullable
    - `name` string
    - `categories` integer[]
    - `shortest` string, nullable
    - `longest` string, nullable
    - `newerThanDays` integer, nullable
    - `olderThanDays` integer, nullable
  - `items` GrantItemWriteRequest[]: Videos already in the grant, pinned, in playing order. They must fit the window; otherwise no grant is made.
    - `video` integer
    - `poster` integer
    - `graphic` integer: Staff only.
    - `duration` string: With `graphic`: how long it is on.

## Response `201`

- AirtimeGrant
  - `id` integer, required
  - `organization` GrantOrganization, required
    - `id` integer, required
    - `name` string, required
  - `starttime` string, date-time, required
  - `endtime` string, date-time, required
  - `state` 'open' | 'locked' | 'compiled' | 'cancelled', required: * `open` - Open * `locked` - Locked * `compiled` - Compiled * `cancelled` - Cancelled
  - `locksAt` string, date-time, required
  - `lockExempt` boolean, required: Editable until air; every save after compiling recompiles it. Staff only.
  - `recipe` Recipe, nullable, required: How the grant fills the time its pinned items leave. Null: hand-made.
    - `id` integer, required
    - `kind` 'uploads' | 'series' | 'playlist' | 'jukebox', required: * `uploads` - Everything the owner uploads * `series` - One of the owner's series * `playlist` - A list of videos * `jukebox` - The video jukebox
    - `description` string, required
    - `series` integer, nullable
    - `seriesName` string, nullable, required
    - `name` string
    - `categories` integer[]
    - `shortest` string, nullable
    - `longest` string, nullable
    - `newerThanDays` integer, nullable
    - `olderThanDays` integer, nullable
  - `originSlot` integer, nullable, required: Provenance only: the grant copied the slot's time when issued.
  - `items` GrantItem[], required
    - `position` integer, required
    - `video` GrantItemVideo, nullable, required
      - `id` integer, required
      - `name` string, required
      - `duration` string, required
      - `organization` GrantOrganization, required
        - `id` integer, required
        - `name` string, required
      - `pendingUpload` boolean, required: An entry made ahead of its file; its duration was set by hand.
      - `liveSource` GrantItemLiveSource, nullable, required: Set for a live programme: it airs from this source until it has a file.
        - `id` integer, required
        - `name` string, required
    - `poster` GrantItemPoster, nullable, required: Set instead of `video` for a text poster.
      - `id` integer, required
      - `template` 'standard' | 'notice', required: * `standard` - Vanlig * `notice` - Viktig melding
      - `heading` string, required
      - `text` string, required
      - `duration` string, required: How long it is on screen each time it airs.
    - `graphic` GrantItemGraphic, nullable, required: Set instead of `video` for a staff graphic, on for `duration`.
      - `id` integer, required
      - `name` string, required
      - `url` string, required: Where CasparCG loads it from: a full address, or a path on the site such as /infographics/ (add ?page=<id> to hold one page). Playout adds ?duration=<ms>.
    - `duration` string, nullable, required: How long the graphic is on. Only for a graphic.
    - `pinned` boolean, required: Chosen by the owner. Automatic filling keeps it and fills around it.
  - `itemsDuration` string, required: From the grant's start to the end of the list, with the gaps that start each programme on the five-minute grid.
  - `padded` boolean, required: Whether programmes start on the five-minute grid, at least 30 s after the programme before. Posters follow whatever is before them. False for a jukebox grant, which plays back to back.
  - `canEdit` boolean, required: Whether the requesting user may replace the list right now.
  - `startedItems` integer, required: How many entries at the head of the list have aired, are on air or start within seconds. Staff may change what follows them, and move the end, while the grant is on air.
  - `airedItems` integer, required: How many entries at the head of the list have finished airing. An edit must keep them first, as they are. Staff may leave out the ones between this and `startedItems`: that takes them off the air at once.

## Other responses

- `400`
- `401`
- `403`
- `404`
- `405`
- `406`
- `415`
- `500`

## Changes

- **2026-11-16** `deeacd00bbb6`: 1 breaking, 5 info
  - added `#/components/schemas/GrantsCreateItemsINDEXGraphicErrorComponent, #/components/schemas/GrantsCreateItemsINDEXDurationErrorComponent` to the `oneOf[#/components/schemas/GrantsCreateValidationError]/errors/items/` response property `oneOf` list for the response status `400`
  - added the new optional request property `items/items/duration`
  - added the new optional request property `items/items/graphic`
  - added `items.INDEX.graphic, items.INDEX.duration` discriminator mapping keys to the `oneOf[#/components/schemas/GrantsCreateValidationError]/errors/items/` response property for the response status `400`
  - …2 more
- **2026-11-16** `d41a12e49411`: 1 info
  - added the required property `airedItems` to the response with the `201` status
- **2026-11-16** `f1620d3cfe01`: 1 info
  - added the required property `startedItems` to the response with the `201` status
- …earlier changes not shown

[Operation history](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/changes/api/grants/post.md)

---

[API](https://skmtc.dev/frikanalen/apis/frikanalen-django-api.md) - [All operations](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/llms.txt) - [OpenAPI document](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/revisions/ebd4175e41fe?raw)
