{
  "openapi": "3.1.0",
  "info": {
    "title": "adkix API",
    "version": "1.0.0",
    "summary": "Make short brand videos from a website, driven by your AI.",
    "description": "adkix turns a website into a short video ad, step by step: brand, angle, style, cast, script, voice, shoot, music. Your AI drives the steps, the person validates each one and says yes to every price. Docs: https://adkix.ai/developers",
    "contact": {
      "name": "adkix",
      "url": "https://adkix.ai/developers"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://adkix.ai/cgu"
    }
  },
  "servers": [
    {
      "url": "https://adkix.ai/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "The account of the key."
    },
    {
      "name": "Contents",
      "description": "A content = one video project."
    },
    {
      "name": "Files",
      "description": "Previews, film and exports."
    },
    {
      "name": "Webhooks",
      "description": "Events sent to your server (beta, on activation)."
    },
    {
      "name": "Meta",
      "description": "This description."
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getAccount",
        "summary": "Get the account of the API key: name, credit balance, plan, free video.",
        "description": "Call first to check the key works and how many credits are left. freeVideo tells whether the welcome video can still be used (offer: free in createContent).",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/contents": {
      "get": {
        "operationId": "listContents",
        "summary": "List the 50 latest contents (videos) of the account and of its shared team projects.",
        "tags": [
          "Contents"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contents"
                  ],
                  "properties": {
                    "contents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ContentSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createContent",
        "summary": "Create a content from a website, an @instagram account or an idea. Reads the site (brand).",
        "description": "Starts a new video project and reads the brand from the site. Nothing expensive starts here: every paid step later answers a quote that the person must accept (confirmQuote). Limit: 10 per day per key.",
        "tags": [
          "Contents"
        ],
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContent"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created: the content and its first state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Created"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/contents/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Content id (contentId from createContent, or id from listContents).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getContent",
        "summary": "Get the state of a content: step, progress, allowed actions, suggestion, previews, film, quote.",
        "description": "The single source of truth. Read actions/suggested to know what to do next, previews to show the person, pendingQuote for a price waiting for a yes. waitSec (max 25) holds the answer until something changes.",
        "tags": [
          "Contents"
        ],
        "parameters": [
          {
            "name": "waitSec",
            "in": "query",
            "required": false,
            "description": "Long poll: hold the request up to this many seconds (0-25) and answer as soon as the content changes (step, progress, error, new preview). Use it instead of sleeping between calls; the header x-adkix-waited says changed, timeout or none.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentState"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/contents/{id}/actions": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Content id (contentId from createContent, or id from listContents).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "runAction",
        "summary": "Run one action of the current step (names in state.actions). Priced ones return a quote.",
        "description": "Free actions run at once. A priced action spends nothing: it answers { quote } with the price and a proposalId; show it to the person, then call confirmQuote only after an explicit yes. cancel + proposalId drops a quote.",
        "tags": [
          "Contents"
        ],
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done, or a quote to show to the person.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/QuoteReply"
                    },
                    {
                      "$ref": "#/components/schemas/ActionResult"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/contents/{id}/confirm": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Content id (contentId from createContent, or id from listContents).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "confirmQuote",
        "summary": "Accept a quote and spend the credits. Only after the person said yes to this exact price.",
        "description": "Same as runAction with action confirm. Runs the quoted action once and debits its price. A quote lives 10 minutes; an expired or replaced one answers 409: ask for a new quote.",
        "tags": [
          "Contents"
        ],
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "proposalId"
                ],
                "properties": {
                  "proposalId": {
                    "type": "string",
                    "description": "quote.proposalId from runAction or state.pendingQuote."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/contents/{id}/files/{kind}/{name}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Content id (contentId from createContent, or id from listContents).",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "kind",
          "in": "path",
          "required": true,
          "description": "Preview family.",
          "schema": {
            "type": "string",
            "enum": [
              "moodboard",
              "frames",
              "videos",
              "audio"
            ]
          }
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "File name, last part of a state.previews url (e.g. 1, option-2, cast-a, phrase-3).",
          "schema": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,80}$"
          }
        }
      ],
      "get": {
        "operationId": "getContentFile",
        "summary": "Download one preview (image, clip or audio) listed in state.previews. Bearer required.",
        "tags": [
          "Files"
        ],
        "responses": {
          "200": {
            "description": "The file (image/png, image/jpeg, video/mp4 or audio/mpeg).",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "contentEncoding": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/contents/{id}/video": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Content id (contentId from createContent, or id from listContents).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getContentVideo",
        "summary": "Download or stream the finished film (MP4). Supports Range requests.",
        "tags": [
          "Files"
        ],
        "parameters": [
          {
            "name": "aspect",
            "in": "query",
            "required": false,
            "description": "16:9 for the horizontal version when state.video.aspects has it.",
            "schema": {
              "type": "string",
              "enum": [
                "16:9"
              ]
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "description": "1 adds Content-Disposition: attachment.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The film.",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "contentEncoding": "binary"
                }
              }
            }
          },
          "206": {
            "description": "Partial content (Range).",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "contentEncoding": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/contents/{id}/export/{kind}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Content id (contentId from createContent, or id from listContents).",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "kind",
          "in": "path",
          "required": true,
          "description": "srt = subtitles, cover = cover image, audio = soundtrack, clean = film without burnt-in titles.",
          "schema": {
            "type": "string",
            "enum": [
              "srt",
              "cover",
              "audio",
              "clean"
            ]
          }
        }
      ],
      "get": {
        "operationId": "getContentExport",
        "summary": "Download an export of the finished film: subtitles, cover, audio or clean version.",
        "tags": [
          "Files"
        ],
        "parameters": [
          {
            "name": "aspect",
            "in": "query",
            "required": false,
            "description": "16:9 for the horizontal version.",
            "schema": {
              "type": "string",
              "enum": [
                "16:9"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "contentEncoding": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/links/{token}": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Token of a shareUrl / downloadUrl from the state.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "openSignedLink",
        "summary": "Open a signed link (shareUrl, downloadUrl) without the Bearer header. Valid 24 h.",
        "description": "The links in state.previews[].shareUrl and state.video.shareUrl/downloadUrl. Give them to the person: they open in any browser. A revoked key or an expired link answers 404 link_invalid.",
        "tags": [
          "Files"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "contentEncoding": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "List the account's webhook endpoints (never their secret). Beta, on activation.",
        "tags": [
          "Webhooks"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhooks"
                  ],
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Add an https endpoint that receives the content events. Answers its signing secret once.",
        "description": "Max 5 per account. The endpoint belongs to the key that creates it: revoking the key stops its deliveries. Events default to all four.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "https:// address, public."
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/WebhookEventType"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    {
                      "type": "object",
                      "required": [
                        "secret"
                      ],
                      "properties": {
                        "secret": {
                          "type": "string",
                          "description": "whsec_…, shown once."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "wh_… id.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Remove a webhook endpoint. Pending retries stop.",
        "tags": [
          "Webhooks"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/auth/start": {
      "post": {
        "operationId": "startSignIn",
        "summary": "No key yet: mail a 6-digit code to the person's email (sign-up or sign-in). Nothing is created yet.",
        "description": "Ask the person for their email, call this, then ask for the code they received. Valid 15 min, 3 mails per address per hour.",
        "tags": [
          "Account"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string",
                    "description": "First name, for a new account."
                  },
                  "lang": {
                    "type": "string",
                    "enum": [
                      "fr",
                      "en",
                      "es"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "requestId"
                  ],
                  "properties": {
                    "requestId": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "expiresInSec": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/auth/verify": {
      "post": {
        "operationId": "verifySignIn",
        "summary": "Trade the mailed code for an API key (shown once). Creates the account if new, with welcome credits.",
        "description": "5 wrong codes kill the request (code expired: call startSignIn again). Store the key privately, never show it in the chat.",
        "tags": [
          "Account"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "requestId",
                  "code"
                ],
                "properties": {
                  "requestId": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string",
                    "description": "6 digits."
                  },
                  "keyName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed in: an existing account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIn"
                }
              }
            }
          },
          "201": {
            "description": "Account created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIn"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApiSpec",
        "summary": "This document. ?profile=gpt for the custom GPT Actions profile (JSON operations only).",
        "tags": [
          "Meta"
        ],
        "security": [],
        "parameters": [
          {
            "name": "profile",
            "in": "query",
            "required": false,
            "description": "gpt = Actions profile.",
            "schema": {
              "type": "string",
              "enum": [
                "full",
                "gpt"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "webhooks": {
    "content.step_ready": {
      "post": {
        "operationId": "on_content_step_ready",
        "summary": "Nothing runs and the content waits for the person: show the new step and ask.",
        "description": "Verify Adkix-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>, constant-time compare, refuse t older than 5 min. Answer any 2xx within 10 s; else retried after 1 and 10 min.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Adkix-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Adkix-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received."
          }
        }
      }
    },
    "content.quote_pending": {
      "post": {
        "operationId": "on_content_quote_pending",
        "summary": "A price waits for a yes (data.quote).",
        "description": "Verify Adkix-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>, constant-time compare, refuse t older than 5 min. Answer any 2xx within 10 s; else retried after 1 and 10 min.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Adkix-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Adkix-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received."
          }
        }
      }
    },
    "content.video_ready": {
      "post": {
        "operationId": "on_content_video_ready",
        "summary": "The film is rendered (data.video.shareUrl, 24 h).",
        "description": "Verify Adkix-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>, constant-time compare, refuse t older than 5 min. Answer any 2xx within 10 s; else retried after 1 and 10 min.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Adkix-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Adkix-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received."
          }
        }
      }
    },
    "content.failed": {
      "post": {
        "operationId": "on_content_failed",
        "summary": "The content stopped on an error.",
        "description": "Verify Adkix-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>, constant-time compare, refuse t older than 5 min. Answer any 2xx within 10 s; else retried after 1 and 10 min.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Adkix-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Adkix-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "adk_live_…",
        "description": "Personal key from https://adkix.ai/compte (API section). Authorization: Bearer adk_live_…"
      }
    },
    "schemas": {
      "SignedIn": {
        "type": "object",
        "required": [
          "key",
          "created"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "adk_live_… — Bearer key, shown once."
          },
          "created": {
            "type": "boolean",
            "description": "true = new account."
          },
          "email": {
            "type": "string"
          },
          "balance": {
            "type": "integer",
            "description": "Credits."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human message (French), safe to show."
          },
          "code": {
            "type": "string",
            "description": "Stable machine code.",
            "examples": [
              "auth",
              "rate",
              "not_found",
              "method_not_allowed",
              "bad_action",
              "not_in_api",
              "bad_source",
              "bad_brief",
              "free_refused",
              "notEnoughCredits",
              "proposalExpired",
              "proposalSuperseded",
              "service_unavailable",
              "site_down",
              "site_blocked",
              "verify_email",
              "link_invalid",
              "email",
              "bad_code",
              "expired",
              "mail_not_sent",
              "too_many_keys"
            ]
          },
          "reason": {
            "type": "string",
            "description": "free_refused: why the free video is refused."
          },
          "validActions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "bad_action: every valid action name."
          },
          "credits": {
            "type": "object",
            "properties": {
              "need": {
                "type": "number"
              },
              "balance": {
                "type": "number"
              }
            },
            "description": "notEnoughCredits: price and balance."
          }
        }
      },
      "Account": {
        "type": "object",
        "required": [
          "id",
          "name",
          "balance",
          "freeVideo"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "balance": {
            "type": "number",
            "description": "Credits left."
          },
          "plan": {
            "type": [
              "string",
              "null"
            ]
          },
          "freeVideo": {
            "type": "string",
            "enum": [
              "available",
              "verify_email",
              "used",
              "unavailable"
            ]
          }
        }
      },
      "ContentSummary": {
        "type": "object",
        "required": [
          "id",
          "status",
          "videoReady"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "projectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "step": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Step"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "thumbUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Relative URL, Bearer required."
          },
          "videoReady": {
            "type": "boolean"
          }
        }
      },
      "CreateContent": {
        "type": "object",
        "required": [
          "source"
        ],
        "properties": {
          "source": {
            "type": "object",
            "description": "url (a website or an @instagram account) or idea (free text, no site).",
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 500
              },
              "idea": {
                "type": "string",
                "maxLength": 1000
              }
            }
          },
          "offer": {
            "type": "string",
            "enum": [
              "paid",
              "free"
            ],
            "default": "paid",
            "description": "free = the account's welcome video (needs source.url)."
          },
          "igConsent": {
            "type": "boolean",
            "description": "true when the person agreed to read their public Instagram posts."
          },
          "brief": {
            "$ref": "#/components/schemas/Brief"
          }
        }
      },
      "Brief": {
        "type": "object",
        "description": "Optional wishes. They start nothing: they fill state.suggested.",
        "properties": {
          "duration": {
            "type": "integer",
            "enum": [
              15,
              30,
              60
            ],
            "description": "Seconds."
          },
          "language": {
            "type": "string",
            "description": "Voice-over language code.",
            "examples": [
              "fr",
              "en",
              "es",
              "de",
              "it",
              "pt",
              "af",
              "ar"
            ]
          },
          "platforms": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "tiktok",
                "instagram",
                "shorts",
                "youtube"
              ]
            }
          },
          "note": {
            "type": "string",
            "maxLength": 2000,
            "description": "Free brief: offer, audience, tone, what must be said."
          }
        }
      },
      "Created": {
        "type": "object",
        "required": [
          "contentId",
          "webUrl",
          "state"
        ],
        "properties": {
          "contentId": {
            "type": "string"
          },
          "projectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "webUrl": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/ContentState"
          }
        }
      },
      "ActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "A name from state.actions, or cancel. Use confirmQuote to accept a quote."
          },
          "args": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arguments, shaped as the action's hint in state.actions says."
          },
          "proposalId": {
            "type": "string",
            "description": "cancel (or confirm): the quote it answers."
          }
        }
      },
      "Quote": {
        "type": "object",
        "required": [
          "proposalId",
          "action",
          "price"
        ],
        "properties": {
          "proposalId": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "price": {
            "type": "number",
            "description": "Credits debited on confirm."
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "What will happen, in words for the person."
          },
          "free": {
            "type": "boolean",
            "description": "true on the free video: price is not debited."
          },
          "requoted": {
            "type": "boolean"
          },
          "expiresInSec": {
            "type": "integer",
            "description": "600."
          }
        }
      },
      "QuoteReply": {
        "type": "object",
        "required": [
          "quote"
        ],
        "properties": {
          "quote": {
            "$ref": "#/components/schemas/Quote"
          }
        }
      },
      "ActionResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "note": {
            "type": "string",
            "description": "What the action did."
          },
          "jobId": {
            "type": "string",
            "description": "When the action made a new content."
          }
        },
        "additionalProperties": true
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "content.step_ready",
          "content.quote_pending",
          "content.video_ready",
          "content.failed"
        ]
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "createdAt": {
            "type": "string"
          },
          "lastDelivery": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "at": {
                "type": "string"
              },
              "event": {
                "type": "string"
              },
              "http": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "ok": {
                "type": "boolean"
              },
              "error": {
                "type": "string"
              }
            }
          }
        }
      },
      "WebhookPayload": {
        "type": "object",
        "required": [
          "id",
          "type",
          "createdAt",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "evt_…, also in the Adkix-Event-Id header."
          },
          "type": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "createdAt": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "required": [
              "contentId",
              "status",
              "step",
              "webUrl"
            ],
            "properties": {
              "contentId": {
                "type": "string"
              },
              "projectId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/components/schemas/JobStatus"
              },
              "step": {
                "$ref": "#/components/schemas/Step"
              },
              "webUrl": {
                "type": "string"
              },
              "video": {
                "type": "object",
                "properties": {
                  "shareUrl": {
                    "type": "string"
                  }
                },
                "description": "content.video_ready: signed link, 24 h."
              },
              "quote": {
                "type": "object",
                "properties": {
                  "proposalId": {
                    "type": "string"
                  },
                  "action": {
                    "type": "string"
                  },
                  "price": {
                    "type": "number"
                  }
                },
                "description": "content.quote_pending."
              }
            }
          }
        }
      },
      "Step": {
        "type": "string",
        "enum": [
          "marque",
          "elements",
          "format",
          "angle",
          "medium",
          "style",
          "narration",
          "options",
          "casting",
          "script",
          "voix",
          "qualite",
          "tournage",
          "son",
          "reel"
        ],
        "description": "Rail step. The order can change with the style flow; trust state.step and state.rail."
      },
      "JobStatus": {
        "type": "string",
        "enum": [
          "brief",
          "ingest",
          "moodboard",
          "moodboard_review",
          "script",
          "script_review",
          "frames",
          "render",
          "done",
          "error"
        ]
      },
      "Preview": {
        "type": "object",
        "required": [
          "kind",
          "label",
          "url"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "style-option",
              "board",
              "type",
              "cast",
              "frame",
              "voice",
              "music",
              "clip"
            ]
          },
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "Relative, Bearer required."
          },
          "shareUrl": {
            "type": "string",
            "description": "Absolute, opens in any browser for 24 h. Give this one to the person."
          }
        }
      },
      "ContentState": {
        "type": "object",
        "required": [
          "id",
          "status",
          "step",
          "actions",
          "previews",
          "pollAfterSec"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "projectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "webUrl": {
            "type": "string",
            "description": "The content in the adkix web app."
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "step": {
            "$ref": "#/components/schemas/Step"
          },
          "rail": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Each step: todo, active, done or error."
          },
          "busy": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "label": {
                "type": "string"
              }
            },
            "description": "Something is running: wait (getContent with waitSec)."
          },
          "progress": {
            "type": "object",
            "additionalProperties": true
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "step": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "free": {
            "type": "boolean"
          },
          "balance": {
            "type": "number"
          },
          "context": {
            "type": "object",
            "additionalProperties": true,
            "description": "What is decided so far: brand, angle, style, cast, script, voice…"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "hint": {
                  "type": "string"
                }
              }
            },
            "description": "Allowed now."
          },
          "suggested": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "action": {
                "type": "string"
              },
              "args": {
                "type": "object",
                "additionalProperties": true
              },
              "price": {
                "type": "number"
              }
            },
            "description": "adkix's next click. Never run by the server."
          },
          "previews": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Preview"
            }
          },
          "video": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ready": {
                "type": "boolean"
              },
              "url": {
                "type": "string"
              },
              "aspects": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "shareUrl": {
                "type": "string"
              },
              "downloadUrl": {
                "type": "string"
              },
              "linkExpiresInSec": {
                "type": "integer"
              }
            }
          },
          "pendingQuote": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Quote"
              },
              {
                "type": "null"
              }
            ]
          },
          "notice": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "kind": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "at": {
                "type": "string"
              }
            }
          },
          "pollAfterSec": {
            "type": "integer",
            "description": "10 while busy, else 30."
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request: bad_action, not_in_api, bad_source, bad_brief.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, wrong or revoked key (code auth); on /auth/verify a wrong or expired code (bad_code, expired).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "Not enough credits (notEnoughCredits, credits.need / credits.balance).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Unknown or not yours (not_found, link_invalid).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "Quote expired or replaced (proposalExpired, proposalSuperseded) or not allowed at this step.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests (rate). Wait Retry-After seconds.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        }
      },
      "Unavailable": {
        "description": "A provider is down (service_unavailable). Retry later.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}