{
  "openapi": "3.1.0",
  "info": {
    "title": "Muzekit API",
    "version": "2026-10-01",
    "description": "Sessions for the embedded editor, end users, assets, the brand kit, templates and renders. Every request needs a secret key. See https://muzekit.com/docs/api-reference"
  },
  "externalDocs": {
    "url": "https://muzekit.com/docs/api-reference"
  },
  "servers": [
    {
      "url": "https://api.muzekit.com/v1"
    }
  ],
  "security": [
    {
      "secretKey": []
    }
  ],
  "tags": [
    {
      "name": "Workspace"
    },
    {
      "name": "Sessions"
    },
    {
      "name": "Users"
    },
    {
      "name": "Assets"
    },
    {
      "name": "Brand kit"
    },
    {
      "name": "Stock"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Renders"
    }
  ],
  "paths": {
    "/workspace": {
      "get": {
        "operationId": "getWorkspace",
        "summary": "Get the workspace",
        "tags": [
          "Workspace"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/workspace-get"
        },
        "responses": {
          "200": {
            "description": "The workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Workspace"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "Get usage",
        "tags": [
          "Workspace"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/usage-get"
        },
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            },
            "description": "Days back"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage per day",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/sessions": {
      "post": {
        "operationId": "createSession",
        "summary": "Create a session",
        "tags": [
          "Sessions"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/sessions-create"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionInput"
              },
              "example": {
                "user": {
                  "id": "user_42",
                  "name": "Ada"
                },
                "mode": "design"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/users": {
      "get": {
        "operationId": "listUsers",
        "summary": "List users",
        "tags": [
          "Users"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/users-list"
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Only users whose external_id, name or email is containing this text, in any case"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Users, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/User"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "upsertUser",
        "summary": "Create or update a user",
        "tags": [
          "Users"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/users-upsert"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/users/{id}": {
      "get": {
        "operationId": "getUser",
        "summary": "Get a user",
        "tags": [
          "Users"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/users-get"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The user's usr_… id or your own id for them (external_id), URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "The user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/users/{id}/usage": {
      "get": {
        "operationId": "getUserUsage",
        "summary": "Get a user's usage",
        "tags": [
          "Users"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/users-usage"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The user's usr_… id or your own id for them (external_id), URL-encoded"
          }
        ],
        "responses": {
          "200": {
            "description": "This billing period's use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserUsage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/assets": {
      "get": {
        "operationId": "listAssets",
        "summary": "List assets",
        "tags": [
          "Assets"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/assets-list"
        },
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "audio",
                "font"
              ]
            },
            "description": "Only this kind"
          },
          {
            "name": "user",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "usr_…: that end user's uploads"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first, up to 200",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Asset"
                      }
                    }
                  },
                  "required": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/assets/uploads": {
      "post": {
        "operationId": "createUpload",
        "summary": "Upload an asset",
        "tags": [
          "Assets"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/assets-upload"
        },
        "description": "Returns a link that takes one PUT of the file's bytes, for 15 minutes.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "type": {
                    "type": "string",
                    "description": "The file's MIME type"
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Refused early when over the limit"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "image",
                      "video",
                      "audio",
                      "font"
                    ]
                  },
                  "family": {
                    "type": "string",
                    "description": "Fonts: the family name in the font list"
                  },
                  "user": {
                    "type": "string",
                    "description": "Upload into this end user's library"
                  },
                  "brand": {
                    "type": "boolean",
                    "description": "Add to the editor's brand kit (not with user)"
                  }
                },
                "required": [
                  "name",
                  "type"
                ]
              },
              "example": {
                "name": "logo.png",
                "type": "image/png",
                "brand": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "An upload link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/assets/{id}": {
      "delete": {
        "operationId": "deleteAsset",
        "summary": "Delete an asset",
        "tags": [
          "Assets"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/assets-delete"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ast_…"
          },
          {
            "name": "user",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "usr_…: a file in that end user's library"
          },
          {
            "name": "force",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "true deletes it even when templates still use it (409 asset_in_use otherwise)"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/brand": {
      "get": {
        "operationId": "getBrand",
        "summary": "Get the brand kit",
        "tags": [
          "Brand kit"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/brand-get"
        },
        "responses": {
          "200": {
            "description": "The brand kit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/brand/colors": {
      "post": {
        "operationId": "addBrandColor",
        "summary": "Add a brand color",
        "tags": [
          "Brand kit"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/brand-get"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Hex, like #3B6EF5"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 60
                  }
                },
                "required": [
                  "value"
                ]
              },
              "example": {
                "value": "#3B6EF5",
                "name": "Primary"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The color",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/brand/{id}": {
      "patch": {
        "operationId": "updateBrandItem",
        "summary": "Update a brand item",
        "tags": [
          "Brand kit"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/brand-update"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ast_…"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "tags": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 50
                    },
                    "description": "Replaces the item's tags"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteBrandItem",
        "summary": "Remove a brand kit item",
        "tags": [
          "Brand kit"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/brand-get"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ast_…"
          },
          {
            "name": "force",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "true deletes it even when templates still use it (409 asset_in_use otherwise)"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "operationId": "listTemplates",
        "summary": "List templates",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-list"
        },
        "parameters": [
          {
            "name": "user",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "usr_…: list this user's templates instead of the workspace's"
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Only templates with this exact tag"
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Only templates whose name or key is containing this text, in any case"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Templates, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Template"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createTemplate",
        "summary": "Create a template",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-create"
        },
        "description": "A document that breaks a rule returns 400 invalid_document with every problem in problems.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/{id}": {
      "get": {
        "operationId": "getTemplate",
        "summary": "Get a template",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-get"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          }
        ],
        "responses": {
          "200": {
            "description": "The template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateTemplate",
        "summary": "Update a template",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-update"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplatePatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteTemplate",
        "summary": "Delete a template",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-delete"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/{id}/parameters": {
      "get": {
        "operationId": "getTemplateParameters",
        "summary": "Template parameters",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-parameters"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          }
        ],
        "responses": {
          "200": {
            "description": "Parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "template": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Parameter"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/{id}/duplicate": {
      "post": {
        "operationId": "duplicateTemplate",
        "summary": "Duplicate a template",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-duplicate"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "external_id": {
                    "type": "string"
                  },
                  "user": {
                    "type": "string",
                    "description": "usr_…: make the copy this end user's design"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "description": "With user, the copy is that end user's design (no key unless external_id is sent)."
      }
    },
    "/templates/{id}/document": {
      "get": {
        "operationId": "getTemplateDocument",
        "summary": "Get a document",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-document-get"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          }
        ],
        "responses": {
          "200": {
            "description": "The current document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "The revision, e.g. \"3\". Send it back as If-Match"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "put": {
        "operationId": "updateTemplateDocument",
        "summary": "Update a document",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-document-update"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The revision you edited, e.g. \"3\". Required unless the body has revision"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "document": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "The full document: pages, and optional meta and ext"
                  },
                  "revision": {
                    "type": [
                      "integer",
                      "string"
                    ],
                    "description": "The revision you edited, for clients that can't set If-Match (3 or \"3\"). If-Match wins when both are sent"
                  }
                },
                "required": [
                  "document"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "document"
                    },
                    "template": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "integer"
                    }
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "The new revision"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "428": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/{id}/versions": {
      "get": {
        "operationId": "listTemplateVersions",
        "summary": "List versions",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-versions-list"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Versions on a page, 1 to 100 (100 when left out)"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Versions, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Version"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/{id}/versions/{version}/document": {
      "get": {
        "operationId": "getTemplateVersionDocument",
        "summary": "Get a version's document",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-version-document-get"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The version's ver_… id or its number"
          }
        ],
        "responses": {
          "200": {
            "description": "The version and its document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VersionDocument"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/{id}/share": {
      "post": {
        "operationId": "createTemplateShare",
        "summary": "Create a share link",
        "tags": [
          "Templates"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/templates-share"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplateId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "view",
                      "play"
                    ],
                    "default": "view"
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365,
                    "description": "The link ends after this many days; never when left out"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Share"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/renders": {
      "post": {
        "operationId": "createRender",
        "summary": "Render a template",
        "tags": [
          "Renders"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/renders-create"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "Prefer",
            "in": "header",
            "schema": {
              "type": "string",
              "enum": [
                "wait"
              ]
            },
            "description": "wait: for a video too, wait up to 60 seconds for the finished render instead of answering 202 at once"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderInput"
              },
              "example": {
                "template": "tpl_Vk1t4l9xvQv",
                "format": "png",
                "modifications": {
                  "headline": "Summer sale"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The finished render",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Render"
                }
              }
            }
          },
          "202": {
            "description": "A queued render: a video, a render of more than 20 pages, or one still running after 60 seconds. Follow it with GET /renders/{id} or the render.succeeded webhook",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Render"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listRenders",
        "summary": "List renders",
        "tags": [
          "Renders"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/renders-list"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          },
          {
            "name": "batch",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "bat_…: one batch's renders"
          },
          {
            "name": "template",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Only this template's renders: its tpl_… id or its key"
          }
        ],
        "responses": {
          "200": {
            "description": "Renders, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Render"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/renders/batch": {
      "post": {
        "operationId": "createRenderBatch",
        "summary": "Render a batch",
        "tags": [
          "Renders"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/renders-batch"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchInput"
              },
              "example": {
                "template": "product-card",
                "format": "png",
                "items": [
                  {
                    "modifications": {
                      "title": "Blue mug"
                    }
                  },
                  {
                    "modifications": {
                      "title": "Red mug"
                    },
                    "size": "1080x1920"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The queued renders",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/renders/{id}": {
      "get": {
        "operationId": "getRender",
        "summary": "Get a render",
        "tags": [
          "Renders"
        ],
        "externalDocs": {
          "url": "https://muzekit.com/docs/api-reference/renders-get"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "rnd_…"
          }
        ],
        "responses": {
          "200": {
            "description": "The render",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Render"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "secretKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A secret key: mk_test_… or mk_live_… (older mk_dev_…, mk_staging_… and mk_sandbox_… keys work as Test keys). A key only sees its own environment's data."
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      },
      "After": {
        "name": "after",
        "in": "query",
        "schema": {
          "type": "string"
        },
        "description": "next_cursor from the previous page"
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "Repeating the request within 24 hours returns the first response (with Idempotent-Replayed: true)"
      },
      "TemplateId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "The template's tpl_… id or its key"
      }
    },
    "responses": {
      "Error": {
        "description": "An error. See https://muzekit.com/docs/errors",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "not_found_error",
                  "conflict_error",
                  "rate_limit_error",
                  "api_error"
                ]
              },
              "code": {
                "type": "string",
                "description": "Stable, snake_case. See https://muzekit.com/docs/errors"
              },
              "message": {
                "type": "string"
              },
              "docs_url": {
                "type": "string",
                "format": "uri"
              },
              "param": {
                "type": "string",
                "description": "The request field at fault, when there is one"
              }
            },
            "required": [
              "type",
              "code",
              "message"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "error"
        ]
      },
      "Deleted": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "deleted": {
            "const": true
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "Workspace": {
        "type": "object",
        "properties": {
          "object": {
            "const": "workspace"
          },
          "id": {
            "type": "string",
            "description": "ws_…"
          },
          "name": {
            "type": "string"
          },
          "environment": {
            "type": "string",
            "enum": [
              "development",
              "staging",
              "production"
            ]
          },
          "region": {
            "type": "string"
          },
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "live": {
                "type": "boolean",
                "description": "False when sessions are refused; reason says why"
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "no_plan",
                  "payment_failed",
                  "subscription_paused",
                  null
                ]
              },
              "interval": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "monthly",
                  "yearly",
                  null
                ]
              },
              "limits": {
                "type": "object",
                "description": "Your plan's limits (members, sessions, localhost_sessions, api_credits, ai_credits, storage_gb, library_picks, origins, render_days, video_length, audio_tracks). A null limit is unlimited",
                "additionalProperties": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              },
              "period": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The current billing period and what it has used",
                "properties": {
                  "start": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "end": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "sessions_used": {
                    "type": "integer"
                  },
                  "localhost_sessions_used": {
                    "type": "integer"
                  },
                  "api_credits_used": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      },
      "UsageCounts": {
        "type": "object",
        "properties": {
          "active_users": {
            "type": "integer"
          },
          "sessions": {
            "type": "integer"
          },
          "templates_created": {
            "type": "integer"
          },
          "templates_saved": {
            "type": "integer"
          },
          "downloads": {
            "type": "integer"
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "object": {
            "const": "usage"
          },
          "environment": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "total": {
            "$ref": "#/components/schemas/UsageCounts"
          },
          "days": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date"
                    }
                  }
                },
                {
                  "$ref": "#/components/schemas/UsageCounts"
                }
              ]
            }
          }
        }
      },
      "Asset": {
        "type": "object",
        "properties": {
          "object": {
            "const": "asset"
          },
          "id": {
            "type": "string",
            "description": "ast_…"
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "font",
              "color"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Colors: the hex value"
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "MIME type"
          },
          "size": {
            "type": [
              "integer",
              "null"
            ]
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "family": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fonts: the family name"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Upload": {
        "type": "object",
        "properties": {
          "object": {
            "const": "upload"
          },
          "upload_url": {
            "type": "string",
            "description": "PUT the file's bytes here, once, within 15 minutes"
          },
          "url": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "expires_in": {
            "type": "integer",
            "description": "Seconds"
          }
        }
      },
      "Brand": {
        "type": "object",
        "properties": {
          "object": {
            "const": "brand"
          },
          "colors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          },
          "fonts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "object": {
            "const": "user"
          },
          "id": {
            "type": "string",
            "description": "usr_…"
          },
          "external_id": {
            "type": "string",
            "description": "Your own id for this user"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "locale": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "last_active_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UserInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Your own id for this user"
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "locale": {
            "type": "string",
            "maxLength": 20,
            "description": "Editor language, e.g. en, de"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Your own data, up to 4 KB"
          }
        },
        "required": [
          "id"
        ]
      },
      "SessionInput": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/UserInput"
          },
          "mode": {
            "type": "string",
            "enum": [
              "design",
              "fill",
              "view"
            ],
            "default": "design"
          },
          "template": {
            "type": "string",
            "description": "tpl_… or the template's key, to open"
          },
          "locale": {
            "type": "string",
            "maxLength": 20,
            "description": "Overrides the user locale for this session"
          },
          "features": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "This session's editor, over the dashboard's Features page, e.g. { \"stock\": false }"
          },
          "formats": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "png",
                "jpg",
                "webp",
                "avif",
                "pdf",
                "html"
              ]
            }
          },
          "videoFormats": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "mp4",
                "webm",
                "gif",
                "mov"
              ]
            }
          },
          "inspector": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "align",
                "position",
                "appearance",
                "typography",
                "fill",
                "media",
                "video",
                "waveform",
                "border",
                "shadow",
                "effects",
                "stacking",
                "repeat",
                "animate"
              ]
            },
            "description": "Design tab sections to hide"
          },
          "fonts": {
            "type": "string",
            "enum": [
              "all",
              "brand"
            ]
          },
          "maxPages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 80
            },
            "maxProperties": 20
          },
          "buttons": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9_-]{1,40}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 30
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "event",
                    "png",
                    "pdf"
                  ]
                },
                "primary": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "label",
                "action"
              ],
              "additionalProperties": false
            }
          },
          "templatePicker": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "panel",
                  "page"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "layout": {
                    "type": "string",
                    "enum": [
                      "panel",
                      "page"
                    ]
                  },
                  "open": {
                    "type": "string",
                    "enum": [
                      "blank",
                      "always",
                      "never"
                    ]
                  },
                  "tab": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "mine",
                      "templates"
                    ]
                  }
                },
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "user"
        ]
      },
      "Session": {
        "type": "object",
        "properties": {
          "object": {
            "const": "session"
          },
          "id": {
            "type": "string",
            "description": "ses_…"
          },
          "client_secret": {
            "type": "string",
            "description": "Single use, valid for 10 minutes. Pass it to the editor on your page; never store it"
          },
          "editor_url": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "mode": {
            "type": "string"
          },
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "template": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Template": {
        "type": "object",
        "properties": {
          "object": {
            "const": "template"
          },
          "id": {
            "type": "string",
            "description": "tpl_…"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The template's key, the same in every environment"
          },
          "user": {
            "type": [
              "string",
              "null"
            ],
            "description": "usr_… when the template belongs to an end user"
          },
          "source": {
            "type": "string"
          },
          "version": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": "integer"
                  },
                  "revision": {
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "page_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "thumbnail_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first page as the editor last saved it; null for templates only written through the API"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TemplateInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "tags": {
            "type": "array",
            "maxItems": 30,
            "items": {
              "type": "string",
              "maxLength": 50
            }
          },
          "external_id": {
            "type": "string",
            "description": "The template's key. Lowercase letters, numbers, dots, dashes and underscores; made from the name when left out"
          },
          "document": {
            "type": "object",
            "additionalProperties": true,
            "description": "A document (see Templates). Without one, a blank 1080 x 1080 page"
          }
        },
        "required": [
          "name"
        ]
      },
      "TemplatePatch": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "tags": {
            "type": "array",
            "maxItems": 30,
            "items": {
              "type": "string",
              "maxLength": 50
            },
            "description": "Replaces the tags"
          },
          "external_id": {
            "type": "string",
            "description": "The template's key. 409 external_id_taken when another template here has it"
          }
        }
      },
      "Parameter": {
        "type": "object",
        "properties": {
          "object": {
            "const": "parameter"
          },
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "page": {
            "type": "integer"
          },
          "default": {
            "description": "The current value"
          },
          "layer": {
            "type": [
              "string",
              "null"
            ]
          },
          "hidden": {
            "type": "boolean"
          }
        }
      },
      "Document": {
        "type": "object",
        "properties": {
          "object": {
            "const": "document"
          },
          "template": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "description": "ver_…"
          },
          "revision": {
            "type": "integer"
          },
          "document": {
            "type": "object",
            "properties": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              },
              "pages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "meta": {
                "type": "object",
                "additionalProperties": true
              },
              "ext": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        }
      },
      "Version": {
        "type": "object",
        "properties": {
          "object": {
            "const": "version"
          },
          "id": {
            "type": "string",
            "description": "ver_…"
          },
          "number": {
            "type": "integer"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer"
          },
          "current": {
            "type": "boolean"
          },
          "page_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Size": {
        "oneOf": [
          {
            "type": "string",
            "description": "A preset (\"instagram-story\", \"youtube-thumbnail\", …) or \"WIDTHxHEIGHT\""
          },
          {
            "type": "object",
            "properties": {
              "width": {
                "type": "number"
              },
              "height": {
                "type": "number"
              }
            },
            "required": [
              "width",
              "height"
            ]
          }
        ]
      },
      "VideoOptions": {
        "type": "object",
        "properties": {
          "duration": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Seconds, when the page has nothing that sets its length"
          },
          "fps": {
            "type": "integer",
            "minimum": 1,
            "description": "Frames per second, up to 30 (GIF: 15)"
          },
          "quality": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "muted": {
            "type": "boolean"
          },
          "trimStart": {
            "type": "number",
            "minimum": 0
          },
          "trimEnd": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "audioSource": {
            "description": "An audio URL for every page, or a track per page",
            "oneOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "track": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              }
            ]
          },
          "subtitleSource": {
            "type": "string",
            "format": "uri",
            "description": "Audio (or a .srt / .vtt file) to caption"
          },
          "subtitleSegments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "number"
                },
                "end": {
                  "type": "number"
                },
                "text": {
                  "type": "string",
                  "maxLength": 500
                }
              },
              "required": [
                "start",
                "end",
                "text"
              ]
            }
          },
          "captionPreset": {
            "type": "string"
          },
          "combinePages": {
            "type": "boolean",
            "description": "Join the pages into one video (not GIF)"
          },
          "pageTransition": {
            "type": "string",
            "description": "fade, dissolve, wipeleft, …"
          },
          "pageTransitionDuration": {
            "type": "number",
            "minimum": 0.1,
            "maximum": 2
          }
        },
        "description": "Video formats only. Other subtitle… options (subtitleColor, subtitleFontSize, …) set the caption style one by one.",
        "patternProperties": {
          "^subtitle[A-Z]\\w*$": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "additionalProperties": false
      },
      "PdfOptions": {
        "type": "object",
        "properties": {
          "margin": {
            "type": [
              "string",
              "number"
            ]
          },
          "marginTop": {
            "type": [
              "string",
              "number"
            ]
          },
          "marginRight": {
            "type": [
              "string",
              "number"
            ]
          },
          "marginBottom": {
            "type": [
              "string",
              "number"
            ]
          },
          "marginLeft": {
            "type": [
              "string",
              "number"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "colorMode": {
            "type": "string",
            "enum": [
              "rgb",
              "cmyk"
            ]
          },
          "imageFormat": {
            "type": "string",
            "enum": [
              "jpeg",
              "png"
            ]
          },
          "imageQuality": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "maxImageDpi": {
            "type": "integer",
            "minimum": 36,
            "maximum": 1200
          }
        },
        "description": "PDF only"
      },
      "RenderInput": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "description": "The template's tpl_… id or key; its current document is rendered"
          },
          "format": {
            "type": "string",
            "enum": [
              "png",
              "jpg",
              "webp",
              "avif",
              "pdf",
              "mp4",
              "webm",
              "gif",
              "mov",
              "mkv"
            ],
            "default": "png"
          },
          "pages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Every page when left out"
          },
          "scale": {
            "type": "number",
            "minimum": 1,
            "maximum": 4,
            "default": 1
          },
          "quality": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "jpg, webp and avif"
          },
          "pdf": {
            "$ref": "#/components/schemas/PdfOptions"
          },
          "video": {
            "$ref": "#/components/schemas/VideoOptions"
          },
          "lang": {
            "type": "string",
            "description": "Language tag for the document (\"ar\" sets right-to-left text)"
          },
          "size": {
            "$ref": "#/components/schemas/Size"
          },
          "extraSizes": {
            "description": "Extra copies at other sizes, up to 10",
            "oneOf": [
              {
                "type": "array",
                "maxItems": 10,
                "items": {
                  "$ref": "#/components/schemas/Size"
                }
              },
              {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/Size"
                }
              }
            ]
          },
          "modifications": {
            "type": "object",
            "additionalProperties": true,
            "description": "Values for the template's parameters: \"headline\", \"page2@headline\", \"headline.color\", \"headline.prompt\""
          }
        },
        "required": [
          "template"
        ]
      },
      "BatchInput": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "description": "The template's tpl_… id or key; its current document is rendered"
          },
          "format": {
            "type": "string",
            "enum": [
              "png",
              "jpg",
              "webp",
              "avif",
              "pdf",
              "mp4",
              "webm",
              "gif",
              "mov",
              "mkv"
            ],
            "default": "png"
          },
          "pages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Every page when left out"
          },
          "scale": {
            "type": "number",
            "minimum": 1,
            "maximum": 4,
            "default": 1
          },
          "quality": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "jpg, webp and avif"
          },
          "pdf": {
            "$ref": "#/components/schemas/PdfOptions"
          },
          "video": {
            "$ref": "#/components/schemas/VideoOptions"
          },
          "lang": {
            "type": "string",
            "description": "Language tag for the document (\"ar\" sets right-to-left text)"
          },
          "size": {
            "$ref": "#/components/schemas/Size"
          },
          "extraSizes": {
            "description": "Extra copies at other sizes, up to 10",
            "oneOf": [
              {
                "type": "array",
                "maxItems": 10,
                "items": {
                  "$ref": "#/components/schemas/Size"
                }
              },
              {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/Size"
                }
              }
            ]
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "properties": {
                "modifications": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "Values for the template's parameters: \"headline\", \"page2@headline\", \"headline.color\", \"headline.prompt\""
                },
                "pages": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "description": "Every page when left out"
                },
                "size": {
                  "$ref": "#/components/schemas/Size"
                }
              }
            }
          }
        },
        "required": [
          "template",
          "items"
        ]
      },
      "Render": {
        "type": "object",
        "properties": {
          "object": {
            "const": "render"
          },
          "id": {
            "type": "string",
            "description": "rnd_…"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "succeeded",
              "failed"
            ]
          },
          "template": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "trigger": {
            "type": "string",
            "description": "What asked for it: api, save (render on save) or download (an editor download, or a file an end user's AI app made)"
          },
          "livemode": {
            "type": "boolean",
            "description": "false for Test renders: free, watermarked TEST and kept 7 days"
          },
          "format": {
            "type": "string"
          },
          "pages": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "integer"
            }
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "page": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "part": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Flow layers: the part of a page that ran onto new pages"
                },
                "size": {
                  "type": "string",
                  "description": "The extra size's name, or WIDTHxHEIGHT"
                },
                "url": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "duration": {
                  "type": "number",
                  "description": "Videos: seconds"
                }
              }
            }
          },
          "video_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Videos only"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Batch": {
        "type": "object",
        "properties": {
          "object": {
            "const": "batch"
          },
          "id": {
            "type": "string",
            "description": "bat_…"
          },
          "template": {
            "type": "string"
          },
          "renders": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/Render"
                },
                {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "render"
                    },
                    "id": {
                      "type": "null"
                    },
                    "status": {
                      "const": "failed"
                    },
                    "item": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "UserUsage": {
        "type": "object",
        "properties": {
          "object": {
            "const": "user_usage"
          },
          "user": {
            "type": "string",
            "description": "usr_…"
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time"
              },
              "end": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "sessions": {
            "type": "integer",
            "description": "Editor sessions the user opened this period"
          },
          "ai_credits_used": {
            "type": "integer"
          },
          "ai_credits_limit": {
            "type": "integer",
            "description": "What one user may spend a period"
          }
        },
        "required": [
          "object",
          "user",
          "period",
          "sessions",
          "ai_credits_used",
          "ai_credits_limit"
        ]
      },
      "VersionDocument": {
        "type": "object",
        "properties": {
          "object": {
            "const": "document"
          },
          "template": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "number": {
            "type": "integer"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "current": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "document": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "object",
          "template",
          "version",
          "number",
          "current",
          "revision",
          "document"
        ]
      },
      "Share": {
        "type": "object",
        "properties": {
          "object": {
            "const": "share"
          },
          "id": {
            "type": "string",
            "description": "shr_…"
          },
          "template": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "view",
              "play"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Shown in this answer only"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "object",
          "id",
          "template",
          "mode",
          "url"
        ]
      }
    }
  }
}
