{"openapi":"3.1.0","info":{"title":"Lokki API","version":"1.0.0","description":"Insert posts programmatically and have Lokki localize them per market, render them into your templates and fonts, route each version to the right TikTok account and publish after approval.\n\nAuthenticate with `Authorization: Bearer lk_live_…` (create keys in Settings → API keys). Errors are `{ \"error\": { \"message\", \"details\" } }`. Timestamps are Unix milliseconds.\n\nRate limit: 120 requests/minute per key (headers X-RateLimit-Limit/Remaining/Reset; 429 with Retry-After)."},"servers":[{"url":"https://uselokki.com/api/v1"}],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"tags":[{"name":"Workspace","description":"Who you are, the brand kit, markets and connected TikTok accounts."},{"name":"Templates","description":"Your video templates (JSON specs) and fonts."},{"name":"Assets","description":"Upload media or import it from a URL."},{"name":"Posts","description":"Create posts that fan out to one variant per market."},{"name":"Variants","description":"One market's version of a post: edit, submit, approve, retry."},{"name":"Approvals","description":"The approval queue. Nothing is posted without a person (or approver key) approving it."},{"name":"Import","description":"Bulk-create posts from a spreadsheet."},{"name":"Analytics","description":"Results per market and top posts."},{"name":"Webhooks","description":"Get notified when variants change status."},{"name":"Platform","description":"File downloads and health (outside /api/v1)."}],"paths":{"/me":{"get":{"operationId":"me","tags":["Workspace"],"summary":"Current workspace and key","description":"Returns the workspace the key belongs to and the key's scopes. Use it to check a key works.","responses":{"200":{"description":"Workspace and auth info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"},"example":{"workspace":{"id":"org_Ab12Cd34Ef56Gh","name":"Wildcamp Co.","slug":"wildcamp-co","plan":"trial"},"auth":{"type":"api_key","key":{"id":"key_Zx81Lq2Mw0","name":"CMS integration","prefix":"lk_live_AbCd","last_used_at":1795000000000},"scopes":["posts:read","posts:write","assets:write","templates:read","templates:write","markets:read","approvals:write","analytics:read","webhooks:write"]},"rate_limit":{"limit":120,"window_seconds":60}}}}},"401":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/brand":{"get":{"operationId":"brand_get","tags":["Workspace"],"summary":"Get the brand kit","description":"**Scope:** `templates:read`","x-required-scopes":["templates:read"],"parameters":[{"name":"brand_id","in":"query","required":false,"description":"Defaults to the first brand","schema":{"type":"string"}}],"responses":{"200":{"description":"Brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"operationId":"brand_update","tags":["Workspace"],"summary":"Update the brand kit","description":"Colours and fonts feed the brand.* tokens in templates; tone, do's/don'ts, glossary and forbidden words steer the localizer. Admin role for session users.\n\n**Scope:** `templates:write`","x-required-scopes":["templates:write"],"parameters":[{"name":"brand_id","in":"query","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBrandRequest"},"examples":{"example1":{"value":{"colors":{"primary":"#FF7A3D"},"fonts":{"heading":"Acme Sans","body":"Inter"},"forbidden_words":["cheapest"]}}}}}},"responses":{"200":{"description":"Updated brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/markets":{"get":{"operationId":"markets_list","tags":["Workspace"],"summary":"List markets","description":"**Scope:** `markets:read`","x-required-scopes":["markets:read"],"responses":{"200":{"description":"Markets","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Market"}}},"required":["data"]},"example":{"data":[{"id":"mkt_de4Gh7Ns2Kd","brand_id":"brd_Kd8sL2pQw1","name":"Germany","country":"DE","language":"de","currency":"EUR","timezone":"Europe/Berlin","notes":"Use 'du'.","offers":[{"title":"Herbst-Angebot","text":"15% off stays in October"}],"hashtags":["glampingdeutschland"],"posting_times":["12:00","19:00"],"daily_post_cap":3,"boost_monthly_budget":500,"boost_daily_cap":25,"auto_submit":true,"flag":"🇩🇪","created_at":1795000000000,"account":{"id":"acc_Wq81Lp0sZt3","username":"wildcamp.de","status":"connected"}}]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"markets_create","tags":["Workspace"],"summary":"Create a market","description":"A market = one country/language/account. Requires the admin role for session users.\n\n**Scope:** `templates:write`","x-required-scopes":["templates:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMarketRequest"},"examples":{"example1":{"value":{"name":"Germany","country":"DE","language":"de","currency":"EUR","timezone":"Europe/Berlin","posting_times":["12:00","19:00"]}}}}}},"responses":{"201":{"description":"Created market","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"},"example":{"id":"mkt_de4Gh7Ns2Kd","brand_id":"brd_Kd8sL2pQw1","name":"Germany","country":"DE","language":"de","currency":"EUR","timezone":"Europe/Berlin","notes":"Use 'du'.","offers":[{"title":"Herbst-Angebot","text":"15% off stays in October"}],"hashtags":["glampingdeutschland"],"posting_times":["12:00","19:00"],"daily_post_cap":3,"boost_monthly_budget":500,"boost_daily_cap":25,"auto_submit":true,"flag":"🇩🇪","created_at":1795000000000,"account":{"id":"acc_Wq81Lp0sZt3","username":"wildcamp.de","status":"connected"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/markets/{id}":{"get":{"operationId":"markets_get","tags":["Workspace"],"summary":"Get a market","description":"**Scope:** `markets:read`","x-required-scopes":["markets:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Market id","schema":{"type":"string"},"example":"mkt_…"}],"responses":{"200":{"description":"Market","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"},"example":{"id":"mkt_de4Gh7Ns2Kd","brand_id":"brd_Kd8sL2pQw1","name":"Germany","country":"DE","language":"de","currency":"EUR","timezone":"Europe/Berlin","notes":"Use 'du'.","offers":[{"title":"Herbst-Angebot","text":"15% off stays in October"}],"hashtags":["glampingdeutschland"],"posting_times":["12:00","19:00"],"daily_post_cap":3,"boost_monthly_budget":500,"boost_daily_cap":25,"auto_submit":true,"flag":"🇩🇪","created_at":1795000000000,"account":{"id":"acc_Wq81Lp0sZt3","username":"wildcamp.de","status":"connected"}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"operationId":"markets_update","tags":["Workspace"],"summary":"Update a market","description":"**Scope:** `templates:write`","x-required-scopes":["templates:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Market id","schema":{"type":"string"},"example":"mkt_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMarketRequest"},"examples":{"example1":{"value":{"daily_post_cap":2,"offers":[{"title":"Winter","text":"20% off in January"}]}}}}}},"responses":{"200":{"description":"Updated market","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"operationId":"markets_delete","tags":["Workspace"],"summary":"Delete a market","description":"Only markets without posts can be deleted.\n\n**Scope:** `templates:write`","x-required-scopes":["templates:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Market id","schema":{"type":"string"},"example":"mkt_…"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"id":{"type":"string"}},"required":["deleted","id"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/accounts":{"get":{"operationId":"accounts_list","tags":["Workspace"],"summary":"List TikTok accounts","description":"Accounts are connected by a person in the dashboard (TikTok OAuth); the API can read them.\n\n**Scope:** `markets:read`","x-required-scopes":["markets:read"],"responses":{"200":{"description":"Accounts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/templates":{"get":{"operationId":"templates_list","tags":["Templates"],"summary":"List templates","description":"**Scope:** `templates:read`","x-required-scopes":["templates:read"],"parameters":[{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"System templates and yours","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"templates_create","tags":["Templates"],"summary":"Create a template","description":"Push your own template spec. See the Templates & fonts guide for the spec reference.\n\n**Scope:** `templates:write`","x-required-scopes":["templates:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateRequest"},"examples":{"example1":{"value":{"name":"Bold hook","category":"custom","spec":{"version":1,"width":1080,"height":1920,"fps":30,"slots":[{"key":"hook","type":"text","label":"Hook","required":true,"maxChars":48,"hint":"Max 6 words, a question or a bold claim"},{"key":"body","type":"text","label":"Body","maxChars":120,"multiline":true},{"key":"cta","type":"text","label":"Call to action","default":"Link in bio"},{"key":"bg","type":"media","label":"Background","accept":["image","video"],"required":true}],"scenes":[{"id":"intro","duration":3,"background":{"type":"media","slot":"bg","fit":"cover","kenBurns":true,"dim":0.25},"layers":[{"id":"hook","type":"text","slot":"hook","x":0.08,"y":0.3,"w":0.76,"h":0.25,"font":{"family":"brand.heading","size":110,"uppercase":true,"autoFit":true,"minSize":64,"maxLines":3},"color":"brand.text","align":"center","valign":"middle","highlightColor":"brand.primary","animation":{"in":"pop","out":"fade"}}]},{"id":"body","duration":4,"transition":"fade","background":{"type":"media","slot":"bg","fit":"cover","dim":0.45},"layers":[{"id":"body","type":"text","slot":"body","x":0.08,"y":0.4,"w":0.76,"h":0.3,"font":{"family":"brand.body","size":60,"weight":600,"autoFit":true,"minSize":40},"color":"#FFFFFF","align":"center","plate":{"color":"rgba(0,0,0,0.55)","radius":18,"padX":24,"padY":12,"mode":"lines"},"animation":{"in":"slide-up"}},{"id":"cta","type":"text","slot":"cta","x":0.15,"y":0.72,"w":0.6,"h":0.07,"font":{"family":"brand.heading","size":54},"color":"#000000","align":"center","plate":{"color":"brand.secondary","radius":40,"padX":32,"padY":14},"start":1.2,"animation":{"in":"zoom"}},{"id":"logo","type":"image","src":"brand.logo","x":0.4,"y":0.1,"w":0.2,"h":0.08,"fit":"contain"}]}]}}}}}}},"responses":{"201":{"description":"Created template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"},"example":{"id":"tpl_Lm2Kx8Qp0Z","name":"Bold hook","description":"Hook, body, CTA over a photo or clip","category":"custom","spec":{"version":1,"width":1080,"height":1920,"fps":30,"slots":[{"key":"hook","type":"text","label":"Hook","required":true,"maxChars":48,"hint":"Max 6 words, a question or a bold claim"},{"key":"body","type":"text","label":"Body","maxChars":120,"multiline":true},{"key":"cta","type":"text","label":"Call to action","default":"Link in bio"},{"key":"bg","type":"media","label":"Background","accept":["image","video"],"required":true}],"scenes":[{"id":"intro","duration":3,"background":{"type":"media","slot":"bg","fit":"cover","kenBurns":true,"dim":0.25},"layers":[{"id":"hook","type":"text","slot":"hook","x":0.08,"y":0.3,"w":0.76,"h":0.25,"font":{"family":"brand.heading","size":110,"uppercase":true,"autoFit":true,"minSize":64,"maxLines":3},"color":"brand.text","align":"center","valign":"middle","highlightColor":"brand.primary","animation":{"in":"pop","out":"fade"}}]},{"id":"body","duration":4,"transition":"fade","background":{"type":"media","slot":"bg","fit":"cover","dim":0.45},"layers":[{"id":"body","type":"text","slot":"body","x":0.08,"y":0.4,"w":0.76,"h":0.3,"font":{"family":"brand.body","size":60,"weight":600,"autoFit":true,"minSize":40},"color":"#FFFFFF","align":"center","plate":{"color":"rgba(0,0,0,0.55)","radius":18,"padX":24,"padY":12,"mode":"lines"},"animation":{"in":"slide-up"}},{"id":"cta","type":"text","slot":"cta","x":0.15,"y":0.72,"w":0.6,"h":0.07,"font":{"family":"brand.heading","size":54},"color":"#000000","align":"center","plate":{"color":"brand.secondary","radius":40,"padX":32,"padY":14},"start":1.2,"animation":{"in":"zoom"}},{"id":"logo","type":"image","src":"brand.logo","x":0.4,"y":0.1,"w":0.2,"h":0.08,"fit":"contain"}]}]},"version":1,"archived":false,"is_system":false,"thumbnail_url":null,"created_at":1795000000000,"updated_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/templates/{id}":{"get":{"operationId":"templates_get","tags":["Templates"],"summary":"Get a template","description":"**Scope:** `templates:read`","x-required-scopes":["templates:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Template id","schema":{"type":"string"},"example":"tpl_…"}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"},"example":{"id":"tpl_Lm2Kx8Qp0Z","name":"Bold hook","description":"Hook, body, CTA over a photo or clip","category":"custom","spec":{"version":1,"width":1080,"height":1920,"fps":30,"slots":[{"key":"hook","type":"text","label":"Hook","required":true,"maxChars":48,"hint":"Max 6 words, a question or a bold claim"},{"key":"body","type":"text","label":"Body","maxChars":120,"multiline":true},{"key":"cta","type":"text","label":"Call to action","default":"Link in bio"},{"key":"bg","type":"media","label":"Background","accept":["image","video"],"required":true}],"scenes":[{"id":"intro","duration":3,"background":{"type":"media","slot":"bg","fit":"cover","kenBurns":true,"dim":0.25},"layers":[{"id":"hook","type":"text","slot":"hook","x":0.08,"y":0.3,"w":0.76,"h":0.25,"font":{"family":"brand.heading","size":110,"uppercase":true,"autoFit":true,"minSize":64,"maxLines":3},"color":"brand.text","align":"center","valign":"middle","highlightColor":"brand.primary","animation":{"in":"pop","out":"fade"}}]},{"id":"body","duration":4,"transition":"fade","background":{"type":"media","slot":"bg","fit":"cover","dim":0.45},"layers":[{"id":"body","type":"text","slot":"body","x":0.08,"y":0.4,"w":0.76,"h":0.3,"font":{"family":"brand.body","size":60,"weight":600,"autoFit":true,"minSize":40},"color":"#FFFFFF","align":"center","plate":{"color":"rgba(0,0,0,0.55)","radius":18,"padX":24,"padY":12,"mode":"lines"},"animation":{"in":"slide-up"}},{"id":"cta","type":"text","slot":"cta","x":0.15,"y":0.72,"w":0.6,"h":0.07,"font":{"family":"brand.heading","size":54},"color":"#000000","align":"center","plate":{"color":"brand.secondary","radius":40,"padX":32,"padY":14},"start":1.2,"animation":{"in":"zoom"}},{"id":"logo","type":"image","src":"brand.logo","x":0.4,"y":0.1,"w":0.2,"h":0.08,"fit":"contain"}]}]},"version":1,"archived":false,"is_system":false,"thumbnail_url":null,"created_at":1795000000000,"updated_at":1795000000000}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"operationId":"templates_update","tags":["Templates"],"summary":"Update a template","description":"System templates are read-only; duplicate them first. Changing the spec bumps `version`. Existing variants keep their render until edited.\n\n**Scope:** `templates:write`","x-required-scopes":["templates:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Template id","schema":{"type":"string"},"example":"tpl_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateRequest"},"examples":{"example1":{"value":{"name":"Bold hook v2"}}}}}},"responses":{"200":{"description":"Updated template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/templates/{id}/duplicate":{"post":{"operationId":"templates_duplicate","tags":["Templates"],"summary":"Duplicate a template","description":"**Scope:** `templates:write`","x-required-scopes":["templates:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Template id","schema":{"type":"string"},"example":"tpl_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateTemplateRequest"},"examples":{"example1":{"value":{"name":"Bold hook (DE)"}}}}}},"responses":{"201":{"description":"The copy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/fonts":{"get":{"operationId":"fonts_list","tags":["Templates"],"summary":"List fonts","description":"Built-in fonts plus the ones you uploaded.\n\n**Scope:** `templates:read`","x-required-scopes":["templates:read"],"responses":{"200":{"description":"Fonts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Font"}},"families":{"type":"array","items":{"type":"string"}}},"required":["data","families"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"fonts_upload","tags":["Templates"],"summary":"Upload a font","description":"Upload one file per weight/style. Family/weight/style are guessed from the filename (AcmeSans-BoldItalic.otf) unless given.\n\n**Scope:** `assets:write`","x-required-scopes":["assets:write"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":".ttf, .otf, .woff or .woff2 (binary)"},"family":{"type":"string"},"weight":{"description":"100..900","type":"string"},"style":{"type":"string","enum":["normal","italic"]}},"required":["file"]}}}},"responses":{"201":{"description":"Font","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Font"},"example":{"id":"fnt_Bx82Lq0Pz1","family":"Acme Sans","weight":700,"style":"normal","source":"upload","builtin":false,"url":"/api/fonts/fnt_Bx82Lq0Pz1/file","created_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/assets":{"post":{"operationId":"assets_create","tags":["Assets"],"summary":"Upload or import media","description":"Send multipart/form-data with `file`, or JSON `{ url }` to have Lokki download it. Max 500 MB.\n\n**Scope:** `assets:write`","x-required-scopes":["assets:write"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Image, video or audio (binary)"}},"required":["file"]}},"application/json":{"schema":{"$ref":"#/components/schemas/ImportAssetRequest"},"examples":{"example1":{"value":{"url":"https://cdn.example.com/photos/forest-dome.jpg"}}}}}},"responses":{"201":{"description":"Asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asset"},"example":{"id":"ast_Q2w8Lm4Kx0Pz","kind":"image","filename":"forest-dome.jpg","mime":"image/jpeg","size":482113,"sha256":"9f2c…","width":1080,"height":1920,"duration":null,"url":"/api/assets/ast_Q2w8Lm4Kx0Pz/file","created_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/assets/{id}":{"get":{"operationId":"assets_get","tags":["Assets"],"summary":"Get asset metadata","description":"**Scope:** `posts:read`","x-required-scopes":["posts:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Asset id","schema":{"type":"string"},"example":"ast_…"}],"responses":{"200":{"description":"Asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Asset"},"example":{"id":"ast_Q2w8Lm4Kx0Pz","kind":"image","filename":"forest-dome.jpg","mime":"image/jpeg","size":482113,"sha256":"9f2c…","width":1080,"height":1920,"duration":null,"url":"/api/assets/ast_Q2w8Lm4Kx0Pz/file","created_at":1795000000000}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts":{"post":{"operationId":"posts_create","tags":["Posts"],"summary":"Create a post","description":"Creates a post and one variant per market. Each variant is localized (AI, your `overrides`, or the source text when the language matches / `translate:false`), rendered into the template, and submitted for approval.\n\n`media` values may be an asset id or `{ \"url\": \"https://…\" }` (imported first; needs `assets:write`).\n\n`markets` accepts ids, language codes (`de`), country codes (`DE`) or `[\"all\"]`.\n\n**Idempotency:** when `external_ref` already exists the existing post is returned with HTTP 200 and `\"idempotent\": true`; new posts return 201.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePostRequest"},"examples":{"ai_localization_for_all_markets":{"summary":"AI localization for all markets","value":{"template_id":"tpl_sys_bold_hook","title":"Autumn midweek deal","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":{"url":"https://cdn.example.com/photos/forest-dome.jpg"}},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"markets":["all"],"external_ref":"cms-4711"}},"your_own_translations":{"summary":"Your own translations","value":{"template_id":"tpl_sys_bold_hook","title":"Autumn midweek deal (own translations)","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two.","markets":["nl","de","gb"],"overrides":{"nl":{"fields":{"hook":"Word wakker *midden* in het bos","body":"Drie nachten, betaal er twee.","cta":"Boek via bio"},"caption":"Drie nachten in het bos, betaal er twee."},"de":{"fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei."}},"translate":false,"external_ref":"cms-4712"}}}}}},"responses":{"200":{"description":"Already existed (same external_ref)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePostResponse"},"example":{"idempotent":true,"post":{"id":"post_7f3k2Qx9Lm2Ab","title":"Autumn midweek deal","template_id":"tpl_sys_bold_hook","brand_id":"brd_Kd8sL2pQw1","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"brief":null,"status":"active","external_ref":"cms-4711","created_via":"api","ai_generated":false,"brand_organic":false,"schedule_at":null,"created_at":1795000000000,"updated_at":1795000000000,"summary":{"markets":3,"by_status":{"localizing":2,"rendering":1}},"metrics":{"views":0,"likes":0,"comments":0,"shares":0},"variants":[{"id":"var_nl9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_nl4Gh7Ns2Kd","market":{"id":"mkt_nl4Gh7Ns2Kd","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account_id":"acc_Wq81Lp0sZt3","language":"nl","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_nl9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_gb9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_gb4Gh7Ns2Kd","market":{"id":"mkt_gb4Gh7Ns2Kd","name":"United Kingdom","country":"GB","language":"en","flag":"🇬🇧"},"account_id":"acc_Wq81Lp0sZt3","language":"en","status":"rendering","status_label":"Rendering","localized_by":"source","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_gb9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}],"links":{"self":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"}}}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePostResponse"},"example":{"idempotent":false,"post":{"id":"post_7f3k2Qx9Lm2Ab","title":"Autumn midweek deal","template_id":"tpl_sys_bold_hook","brand_id":"brd_Kd8sL2pQw1","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"brief":null,"status":"active","external_ref":"cms-4711","created_via":"api","ai_generated":false,"brand_organic":false,"schedule_at":null,"created_at":1795000000000,"updated_at":1795000000000,"summary":{"markets":3,"by_status":{"localizing":2,"rendering":1}},"metrics":{"views":0,"likes":0,"comments":0,"shares":0},"variants":[{"id":"var_nl9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_nl4Gh7Ns2Kd","market":{"id":"mkt_nl4Gh7Ns2Kd","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account_id":"acc_Wq81Lp0sZt3","language":"nl","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_nl9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_gb9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_gb4Gh7Ns2Kd","market":{"id":"mkt_gb4Gh7Ns2Kd","name":"United Kingdom","country":"GB","language":"en","flag":"🇬🇧"},"account_id":"acc_Wq81Lp0sZt3","language":"en","status":"rendering","status_label":"Rendering","localized_by":"source","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_gb9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}],"links":{"self":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"operationId":"posts_list","tags":["Posts"],"summary":"List posts","description":"Newest first. Paginate with `cursor` (preferred) or `offset`.\n\n**Scope:** `posts:read`","x-required-scopes":["posts:read"],"parameters":[{"name":"limit","in":"query","required":false,"description":"1–100, default 25","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"`next_cursor` from the previous page","schema":{"type":"string"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"status","in":"query","required":false,"description":"Posts with at least one variant in this status","schema":{"type":"string","enum":["localizing","rendering","rendered","pending_approval","approved","publishing","published","rejected","failed","skipped"]}},{"name":"q","in":"query","required":false,"description":"Search title and external_ref","schema":{"type":"string"}},{"name":"external_ref","in":"query","required":false,"description":"Exact match","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of posts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostList"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/bulk":{"post":{"operationId":"posts_bulk","tags":["Posts"],"summary":"Create up to 100 posts","description":"Each item is processed independently (same rules as POST /posts). The response always has HTTP 200 with a result per item.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkPostsRequest"},"examples":{"example1":{"value":{"posts":[{"template_id":"tpl_sys_bold_hook","title":"Autumn midweek deal","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":{"url":"https://cdn.example.com/photos/forest-dome.jpg"}},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"markets":["all"],"external_ref":"cms-4711"},{"template_id":"tpl_sys_bold_hook","title":"Autumn midweek deal (own translations)","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two.","markets":["nl","de","gb"],"overrides":{"nl":{"fields":{"hook":"Word wakker *midden* in het bos","body":"Drie nachten, betaal er twee.","cta":"Boek via bio"},"caption":"Drie nachten in het bos, betaal er twee."},"de":{"fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei."}},"translate":false,"external_ref":"cms-4712"}]}}}}}},"responses":{"200":{"description":"Per-item results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkPostsResponse"},"example":{"summary":{"total":2,"created":1,"existing":1,"failed":0},"results":[{"index":0,"status":201,"ok":true,"idempotent":false,"post":{"id":"post_7f3k2Qx9Lm2Ab","title":"Autumn midweek deal","template_id":"tpl_sys_bold_hook","brand_id":"brd_Kd8sL2pQw1","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"brief":null,"status":"active","external_ref":"cms-4711","created_via":"api","ai_generated":false,"brand_organic":false,"schedule_at":null,"created_at":1795000000000,"updated_at":1795000000000,"summary":{"markets":3,"by_status":{"localizing":2,"rendering":1}},"metrics":{"views":0,"likes":0,"comments":0,"shares":0},"variants":[{"id":"var_nl9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_nl4Gh7Ns2Kd","market":{"id":"mkt_nl4Gh7Ns2Kd","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account_id":"acc_Wq81Lp0sZt3","language":"nl","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_nl9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_gb9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_gb4Gh7Ns2Kd","market":{"id":"mkt_gb4Gh7Ns2Kd","name":"United Kingdom","country":"GB","language":"en","flag":"🇬🇧"},"account_id":"acc_Wq81Lp0sZt3","language":"en","status":"rendering","status_label":"Rendering","localized_by":"source","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_gb9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}],"links":{"self":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"}}},{"index":1,"status":200,"ok":true,"idempotent":true,"post":{"id":"post_7f3k2Qx9Lm2Ab","title":"Autumn midweek deal","template_id":"tpl_sys_bold_hook","brand_id":"brd_Kd8sL2pQw1","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"brief":null,"status":"active","external_ref":"cms-4711","created_via":"api","ai_generated":false,"brand_organic":false,"schedule_at":null,"created_at":1795000000000,"updated_at":1795000000000,"summary":{"markets":3,"by_status":{"localizing":2,"rendering":1}},"metrics":{"views":0,"likes":0,"comments":0,"shares":0},"variants":[{"id":"var_nl9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_nl4Gh7Ns2Kd","market":{"id":"mkt_nl4Gh7Ns2Kd","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account_id":"acc_Wq81Lp0sZt3","language":"nl","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_nl9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_gb9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_gb4Gh7Ns2Kd","market":{"id":"mkt_gb4Gh7Ns2Kd","name":"United Kingdom","country":"GB","language":"en","flag":"🇬🇧"},"account_id":"acc_Wq81Lp0sZt3","language":"en","status":"rendering","status_label":"Rendering","localized_by":"source","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_gb9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}],"links":{"self":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}":{"get":{"operationId":"posts_get","tags":["Posts"],"summary":"Get a post with its variants","description":"Poll this (or use webhooks) to follow each market's status. `preview_url` / `video_url` are relative paths under the same host, authenticated like the API.\n\n**Scope:** `posts:read`","x-required-scopes":["posts:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Post id","schema":{"type":"string"},"example":"post_…"}],"responses":{"200":{"description":"Post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Post"},"example":{"id":"post_7f3k2Qx9Lm2Ab","title":"Autumn midweek deal","template_id":"tpl_sys_bold_hook","brand_id":"brd_Kd8sL2pQw1","source_language":"en","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"media":{"bg":"ast_Q2w8Lm4Kx0Pz"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["autumn","midweek"],"brief":null,"status":"active","external_ref":"cms-4711","created_via":"api","ai_generated":false,"brand_organic":false,"schedule_at":null,"created_at":1795000000000,"updated_at":1795000000000,"summary":{"markets":3,"by_status":{"localizing":2,"rendering":1}},"metrics":{"views":0,"likes":0,"comments":0,"shares":0},"variants":[{"id":"var_nl9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_nl4Gh7Ns2Kd","market":{"id":"mkt_nl4Gh7Ns2Kd","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account_id":"acc_Wq81Lp0sZt3","language":"nl","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_nl9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"localizing","status_label":"Localizing","localized_by":null,"fields":{"hook":"…","body":"…","cta":"…"},"caption":"…","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000},{"id":"var_gb9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_gb4Gh7Ns2Kd","market":{"id":"mkt_gb4Gh7Ns2Kd","name":"United Kingdom","country":"GB","language":"en","flag":"🇬🇧"},"account_id":"acc_Wq81Lp0sZt3","language":"en","status":"rendering","status_label":"Rendering","localized_by":"source","fields":{"hook":"Wake up *inside* the forest","body":"Midweek stays, three nights for the price of two.","cta":"Book in bio"},"caption":"Three nights in the forest, pay for two. Monday to Thursday.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":null,"post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":null,"video_url":null,"metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_gb9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}],"links":{"self":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"operationId":"posts_delete","tags":["Posts"],"summary":"Delete a post","description":"Published variants stay on TikTok; the post is then only hidden.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Post id","schema":{"type":"string"},"example":"post_…"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"id":{"type":"string"}},"required":["deleted","id"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/posts/{id}/markets":{"post":{"operationId":"posts_add_markets","tags":["Posts"],"summary":"Add markets to a post","description":"**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Post id","schema":{"type":"string"},"example":"post_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMarketsRequest"},"examples":{"example1":{"value":{"markets":["fr","es"],"overrides":{"fr":{"caption":"Trois nuits, payez-en deux."}}}}}}}},"responses":{"200":{"description":"Post with all variants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Post"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}":{"get":{"operationId":"variant_get","tags":["Variants"],"summary":"Get a variant","description":"**Scope:** `posts:read`","x-required-scopes":["posts:read"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"responses":{"200":{"description":"Variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"operationId":"variant_update","tags":["Variants"],"summary":"Edit a variant's text","description":"Changing text re-renders the video. Not possible while pending approval/approved — withdraw first.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVariantRequest"},"examples":{"example1":{"value":{"fields":{"hook":"Wach *mitten* im Wald auf"},"caption":"Drei Nächte, zahl zwei."}}}}}},"responses":{"200":{"description":"Updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/submit":{"post":{"operationId":"variant_submit","tags":["Variants"],"summary":"Submit for approval","description":"Locks the exact payload (account, video hash, final caption, disclosures, schedule) and adds it to the approval queue. Blocked while text checks have errors.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/withdraw":{"post":{"operationId":"variant_withdraw","tags":["Variants"],"summary":"Withdraw from approval","description":"Back to `rendered` so it can be edited.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/approve":{"post":{"operationId":"variant_approve","tags":["Variants"],"summary":"Approve and schedule","description":"Approves the pending approval of this variant. Publishes at `publish_at`, the post's schedule, or now.\n\n**Scope:** `approvals:write`","x-required-scopes":["approvals:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveRequest"},"examples":{"example1":{"value":{"publish_at":"now"}}}}}},"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/reject":{"post":{"operationId":"variant_reject","tags":["Variants"],"summary":"Reject","description":"A reason is required; it becomes a learning for the localizer.\n\n**Scope:** `approvals:write`","x-required-scopes":["approvals:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectRequest"},"examples":{"example1":{"value":{"reason":"Hook is too formal for TikTok, use 'du'"}}}}}},"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/relocalize":{"post":{"operationId":"variant_relocalize","tags":["Variants"],"summary":"Re-run AI localization","description":"Discards edits and asks the AI again (optionally with a note).\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelocalizeRequest"},"examples":{"example1":{"value":{"note":"Shorter hook, less formal"}}}}}},"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/retry":{"post":{"operationId":"variant_retry","tags":["Variants"],"summary":"Retry a failed variant","description":"Re-renders, or re-submits when the render exists.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/variants/{id}/skip":{"post":{"operationId":"variant_skip","tags":["Variants"],"summary":"Skip this market","description":"This market won't get the post.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Variant id","schema":{"type":"string"},"example":"var_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkipRequest"},"examples":{"example1":{"value":{"reason":"Offer not valid in this country"}}}}}},"responses":{"200":{"description":"The updated variant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"},"example":{"id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","market":{"id":"mkt_de4Gh7Ns2Kd","name":"Germany","country":"DE","language":"de","flag":"🇩🇪"},"account_id":"acc_Wq81Lp0sZt3","language":"de","status":"pending_approval","status_label":"Awaiting approval","localized_by":"ai","fields":{"hook":"Wach *mitten* im Wald auf","body":"Drei Nächte zum Preis von zwei. Montag bis Donnerstag.","cta":"Link in Bio"},"caption":"Drei Nächte im Wald, zahl nur zwei.","hashtags":["wildcamp","glamping"],"checks":[],"edited":false,"scheduled_at":null,"approval_id":"apr_Mx72Ld0QaP1","post_url":null,"tiktok_video_id":null,"published_at":null,"error":null,"render_error":null,"preview_url":"/api/assets/ast_Th4mb9Lx2Q/file","video_url":"/api/assets/ast_Rnd8Kq1Zp4/file","metrics":{"views":0,"likes":0,"comments":0,"shares":0,"avg_watch_time":null,"baseline_ratio":null,"is_winner":false,"synced_at":null},"links":{"self":"/api/v1/variants/var_de9Fk2LmQx81","post":"/api/v1/posts/post_7f3k2Qx9Lm2Ab","dashboard":"/app/posts/post_7f3k2Qx9Lm2Ab"},"created_at":1795000000000,"updated_at":1795000000000}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/approvals":{"get":{"operationId":"approvals_list","tags":["Approvals"],"summary":"Pending approvals","description":"**Scope:** `posts:read`","x-required-scopes":["posts:read"],"parameters":[{"name":"market_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Default 100","schema":{"type":"integer"}}],"responses":{"200":{"description":"Oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PendingApproval"}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/import/csv":{"post":{"operationId":"import_csv","tags":["Import"],"summary":"Import posts from CSV","description":"One row per post; see the CSV guide for columns. Send multipart `file` or a `text/csv` body. `?dry_run=1` validates without creating anything.\n\n**Scope:** `posts:write`","x-required-scopes":["posts:write"],"parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"template_id","in":"query","required":false,"description":"Used for rows without a template_id","schema":{"type":"string"}},{"name":"source_language","in":"query","required":false,"schema":{"type":"string"}},{"name":"markets","in":"query","required":false,"description":"Default markets for rows without a markets cell","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"text/csv":{"schema":{"type":"string"},"examples":{"example1":{"value":"title,template_id,markets,slot:hook,media:bg\nAutumn,tpl_sys_bold_hook,all,Wake up in the forest,https://cdn.example.com/a.jpg\n"}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"CSV file (binary)"}},"required":["file"]}}}},"responses":{"200":{"description":"Per-row results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CsvImportResult"},"example":{"dry_run":false,"delimiter":",","columns":["title","template_id","markets","slot:hook","media:bg"],"unknown_columns":[],"summary":{"rows":1,"ok":1,"created":1,"existing":0,"failed":0},"rows":[{"row":1,"line":2,"ok":true,"status":"created","post_id":"post_7f3k2Qx9Lm2Ab","variants":5,"errors":[]}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/import/csv/template":{"get":{"operationId":"import_csv_template","tags":["Import"],"summary":"CSV header for a template","description":"Returns a CSV with the header row (base columns, slot:/media: columns, and `<lang>:<slot>` columns for your market languages) plus an example row.\n\n**Scope:** `templates:read`","x-required-scopes":["templates:read"],"parameters":[{"name":"template_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"source_language","in":"query","required":false,"schema":{"type":"string"}},{"name":"delimiter","in":"query","required":false,"schema":{"type":"string","enum":[",",";"]}},{"name":"example","in":"query","required":false,"description":"Include an example row (default true)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"CSV file","content":{"text/csv":{"schema":{"type":"string"},"example":"title,template_id,source_language,markets,caption,hashtags,schedule_at,external_ref,ai_generated,brand_organic,slot:hook,media:bg,de:hook,de:caption\r\n"}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/overview":{"get":{"operationId":"analytics_overview","tags":["Analytics"],"summary":"Overview","description":"**Scope:** `analytics:read`","x-required-scopes":["analytics:read"],"parameters":[{"name":"days","in":"query","required":false,"description":"1–365, default 28","schema":{"type":"integer"}}],"responses":{"200":{"description":"Pipeline, totals and per-market results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsOverview"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/top":{"get":{"operationId":"analytics_top","tags":["Analytics"],"summary":"Top variants by views","description":"**Scope:** `analytics:read`","x-required-scopes":["analytics:read"],"parameters":[{"name":"limit","in":"query","required":false,"description":"1–100, default 10","schema":{"type":"integer"}},{"name":"market_id","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Top variants","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks":{"get":{"operationId":"webhooks_list","tags":["Webhooks"],"summary":"List webhooks","description":"**Scope:** `webhooks:write`","x-required-scopes":["webhooks:write"],"responses":{"200":{"description":"Webhooks (without secrets)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["data"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"webhooks_create","tags":["Webhooks"],"summary":"Create a webhook","description":"Events: variant.localized, variant.rendered, variant.pending_approval, variant.approved, variant.rejected, variant.published, variant.failed, boost.proposed, comment.received. The response contains the signing secret once.\n\n**Scope:** `webhooks:write`","x-required-scopes":["webhooks:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookRequest"},"examples":{"example1":{"value":{"url":"https://example.com/hooks/lokki","events":["variant.pending_approval","variant.published","variant.failed"]}}}}}},"responses":{"201":{"description":"Webhook incl. secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"},"example":{"id":"whk_Lp0Zx81Qm2","url":"https://example.com/hooks/lokki","events":["variant.published"],"active":true,"created_at":1795000000000,"secret":"whsec_…"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}":{"delete":{"operationId":"webhooks_delete","tags":["Webhooks"],"summary":"Delete a webhook","description":"**Scope:** `webhooks:write`","x-required-scopes":["webhooks:write"],"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook id","schema":{"type":"string"},"example":"whk_…"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"id":{"type":"string"}},"required":["deleted","id"]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/openapi.json":{"get":{"operationId":"openapi","tags":["Platform"],"summary":"This OpenAPI document","security":[],"responses":{"200":{"description":"OpenAPI 3.1 JSON"}}}},"/api/assets/{id}/file":{"servers":[{"url":"https://uselokki.com","description":"Site root"}],"get":{"operationId":"asset_file","tags":["Platform"],"summary":"Download asset bytes","description":"Images, videos, renders and thumbnails of your workspace. Same auth as the API. Supports `Range` (206) for video scrubbing.","parameters":[{"name":"id","in":"path","required":true,"description":"Asset id","schema":{"type":"string"},"example":"ast_…"},{"name":"download","in":"query","required":false,"description":"Send Content-Disposition: attachment","schema":{"type":"boolean"}}],"responses":{"200":{"description":"File bytes"},"206":{"description":"Partial content"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/fonts/{id}/file":{"servers":[{"url":"https://uselokki.com","description":"Site root"}],"get":{"operationId":"font_file","tags":["Platform"],"summary":"Download a font file","description":"Built-in fonts are public; uploaded fonts need workspace auth.","parameters":[{"name":"id","in":"path","required":true,"description":"Font id","schema":{"type":"string"},"example":"fnt_…"}],"responses":{"200":{"description":"Font bytes"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/health":{"servers":[{"url":"https://uselokki.com","description":"Site root"}],"get":{"operationId":"health","tags":["Platform"],"summary":"Health check","security":[],"responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"db":{"type":"boolean"},"jobs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"worker":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["ok","db","jobs","worker"]}}}},"503":{"description":"Database unavailable"}}}},"/locations":{"get":{"operationId":"locations_list","tags":["Workspace"],"summary":"List locations","description":"Locations of all markets (or one with ?market_id=). Template variables usable in slot text and captions: `{{brand.name}}`, `{{market.name}}`, `{{market.country}}`, `{{location.name}}`, `{{location.city}}`, `{{location.region}}`, `{{location.address}}`, `{{location.phone}}`, `{{location.website}}`, `{{location.opening_hours}}`, `{{location.fact.<label>}}`, `{{offer.title}}`, `{{offer.text}}`, `{{offer.price}}`, `{{offer.valid_until}}` (first valid offer of the location, else the market). They are filled per version when rendering and in the approval payload; a variable without a value blocks approval.\n\n**Scope:** `markets:read`","x-required-scopes":["markets:read"],"parameters":[{"name":"market_id","in":"query","schema":{"type":"string"},"description":"Only this market's locations"},{"name":"active","in":"query","schema":{"type":"boolean"},"description":"true = only active locations"},{"name":"q","in":"query","schema":{"type":"string"},"description":"Search name, city, slug, external_id"}],"responses":{"200":{"description":"Locations","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Location"}}}},"example":{"data":[{"id":"loc_Vb81Kq2Lm0Px","market_id":"mkt_9Qw2Lp0sZt3Kx","name":"Wildcamp Veluwe","slug":"wildcamp-veluwe","city":"Otterlo","region":"Gelderland","address":"Bosweg 1","timezone":null,"phone":"+31 318 000 000","website":"https://example.com/veluwe","opening_hours":"Check-in 15:00–20:00","notes":null,"facts":[{"label":"Pool","value":"heated outdoor pool, open May–September"}],"offers":[{"title":"Forest weekend","text":"2 nights in a lodge","price":"249","valid_until":"2026-12-31"}],"hashtags":["veluwe"],"external_id":"PARK-NL-01","active":true,"created_at":1795000000000,"updated_at":1795000000000,"market":{"id":"mkt_9Qw2Lp0sZt3Kx","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account":{"id":"acc_Wq81Lp0sZt3","username":"wildcamp.veluwe","status":"connected"},"variables":{"brand.name":"Wildcamp","market.name":"Netherlands","location.name":"Wildcamp Veluwe","location.city":"Otterlo","location.fact.pool":"heated outdoor pool, open May–September","offer.title":"Forest weekend","offer.price":"€ 249"}}]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"locations_create","tags":["Workspace"],"summary":"Create a location","description":"A location belongs to one market and inherits its language, currency and hashtags. Connect its own TikTok account in the dashboard (Accounts → Connect for a location). Admin role for session users.\n\n**Scope:** `templates:write`","x-required-scopes":["templates:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLocationRequest"},"example":{"market_id":"mkt_9Qw2Lp0sZt3Kx","name":"Wildcamp Veluwe","city":"Otterlo","external_id":"PARK-NL-01","facts":[{"label":"Pool","value":"heated outdoor pool, open May–September"}]}}}},"responses":{"201":{"description":"Created location","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"},"example":{"id":"loc_Vb81Kq2Lm0Px","market_id":"mkt_9Qw2Lp0sZt3Kx","name":"Wildcamp Veluwe","slug":"wildcamp-veluwe","city":"Otterlo","region":"Gelderland","address":"Bosweg 1","timezone":null,"phone":"+31 318 000 000","website":"https://example.com/veluwe","opening_hours":"Check-in 15:00–20:00","notes":null,"facts":[{"label":"Pool","value":"heated outdoor pool, open May–September"}],"offers":[{"title":"Forest weekend","text":"2 nights in a lodge","price":"249","valid_until":"2026-12-31"}],"hashtags":["veluwe"],"external_id":"PARK-NL-01","active":true,"created_at":1795000000000,"updated_at":1795000000000,"market":{"id":"mkt_9Qw2Lp0sZt3Kx","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account":{"id":"acc_Wq81Lp0sZt3","username":"wildcamp.veluwe","status":"connected"},"variables":{"brand.name":"Wildcamp","market.name":"Netherlands","location.name":"Wildcamp Veluwe","location.city":"Otterlo","location.fact.pool":"heated outdoor pool, open May–September","offer.title":"Forest weekend","offer.price":"€ 249"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/locations/{id}":{"get":{"operationId":"locations_get","tags":["Workspace"],"summary":"Get a location","x-required-scopes":["markets:read"],"description":"**Scope:** `markets:read`","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Location id, slug or external_id","example":"loc_…"}],"responses":{"200":{"description":"Location","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"},"example":{"id":"loc_Vb81Kq2Lm0Px","market_id":"mkt_9Qw2Lp0sZt3Kx","name":"Wildcamp Veluwe","slug":"wildcamp-veluwe","city":"Otterlo","region":"Gelderland","address":"Bosweg 1","timezone":null,"phone":"+31 318 000 000","website":"https://example.com/veluwe","opening_hours":"Check-in 15:00–20:00","notes":null,"facts":[{"label":"Pool","value":"heated outdoor pool, open May–September"}],"offers":[{"title":"Forest weekend","text":"2 nights in a lodge","price":"249","valid_until":"2026-12-31"}],"hashtags":["veluwe"],"external_id":"PARK-NL-01","active":true,"created_at":1795000000000,"updated_at":1795000000000,"market":{"id":"mkt_9Qw2Lp0sZt3Kx","name":"Netherlands","country":"NL","language":"nl","flag":"🇳🇱"},"account":{"id":"acc_Wq81Lp0sZt3","username":"wildcamp.veluwe","status":"connected"},"variables":{"brand.name":"Wildcamp","market.name":"Netherlands","location.name":"Wildcamp Veluwe","location.city":"Otterlo","location.fact.pool":"heated outdoor pool, open May–September","offer.title":"Forest weekend","offer.price":"€ 249"}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"operationId":"locations_update","tags":["Workspace"],"summary":"Update a location","x-required-scopes":["templates:write"],"description":"Versions already approved keep the text they were approved with: if a change alters a resolved caption, the publish gate refuses it and the version needs a new approval.\n\n**Scope:** `templates:write`","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Location id, slug or external_id","example":"loc_…"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLocationRequest"},"example":{"facts":[{"label":"Pool","value":"heated, open all year"}],"active":true}}}},"responses":{"200":{"description":"Updated location","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"operationId":"locations_delete","tags":["Workspace"],"summary":"Delete a location","x-required-scopes":["templates:write"],"description":"Only locations without posts can be deleted; deactivate the others (`active: false`). Its TikTok account becomes unassigned.\n\n**Scope:** `templates:write`","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Location id, slug or external_id","example":"loc_…"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"id":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/locations/import":{"post":{"operationId":"locations_import","tags":["Import"],"summary":"Import locations from CSV","x-required-scopes":["templates:write"],"description":"Create or update many locations at once. Send `text/csv` (options as query parameters), `multipart/form-data` with a `file` field, or JSON `{ csv, market_id, dry_run, update }`.\n\nColumns: `name` (required), `market` (market id, country or language; or pass `market_id`), `slug`, `city`, `region`, `address`, `timezone`, `phone`, `website`, `opening_hours`, `notes`, `hashtags`, `external_id`, `active`, `facts` (`Pool: heated; Dogs: welcome`) and/or one column per fact named `fact:<Label>`, and `offer_title`, `offer_text`, `offer_price`, `offer_valid_until` (one offer per row).\n\nExisting locations (same `external_id`, else same slug) are updated. Rows are validated one by one; bad rows are reported and skipped.\n\n**Scope:** `templates:write`","parameters":[{"name":"market_id","in":"query","schema":{"type":"string"},"description":"Market for rows without a market column"},{"name":"dry_run","in":"query","schema":{"type":"boolean"}},{"name":"update","in":"query","schema":{"type":"boolean"},"description":"false = skip existing locations"}],"requestBody":{"required":true,"content":{"text/csv":{"schema":{"type":"string"},"example":"name,market,city,region,external_id,fact:Pool,fact:Dogs,offer_title,offer_text,offer_price,hashtags\nWildcamp Veluwe,NL,Otterlo,Gelderland,PARK-NL-01,\"heated, open May–Sept\",welcome,Forest weekend,2 nights in a lodge,249,veluwe\nWildcamp Texel,NL,De Koog,Noord-Holland,PARK-NL-02,,,,,,texel"},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"market_id":{"type":"string"},"dry_run":{"type":"boolean"},"update":{"type":"boolean"}},"required":["file"]}},"application/json":{"schema":{"$ref":"#/components/schemas/ImportLocationsRequest"},"example":{"csv":"name,market,city,region,external_id,fact:Pool,fact:Dogs,offer_title,offer_text,offer_price,hashtags\nWildcamp Veluwe,NL,Otterlo,Gelderland,PARK-NL-01,\"heated, open May–Sept\",welcome,Forest weekend,2 nights in a lodge,249,veluwe\nWildcamp Texel,NL,De Koog,Noord-Holland,PARK-NL-02,,,,,,texel","dry_run":true}}}},"responses":{"200":{"description":"Import result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationImportResult"},"example":{"dry_run":false,"created":2,"updated":0,"skipped":0,"rows":[{"row":2,"action":"create","id":"loc_…","name":"Wildcamp Veluwe"},{"row":3,"action":"create","id":"loc_…","name":"Wildcamp Texel"}],"columns":{"recognized":["name","market","city"],"ignored":[]}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/templates/generate":{"post":{"tags":["Template studio"],"summary":"Generate a template from a prompt","description":"Queues a generation (Claude with structured output against the template schema, validated + one repair turn; offline: the closest system template with prompt-driven tweaks, provider \"preset\"). Iterate by passing parent_id. Poll GET /templates/generate/{id}.","security":[{"bearer":["templates:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateTemplateRequest"},"example":{"prompt":"3 reasons to visit, bold, uses our yellow, ends with a CTA","length":15}}}},"responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Template studio"],"summary":"List generations","security":[{"bearer":["templates:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"status","in":"query","schema":{"type":"string","enum":["queued","running","done","failed"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TemplateGeneration"}}}}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/generate/{id}":{"get":{"tags":["Template studio"],"summary":"Get a generation (with spec + preview PNGs when done)","security":[{"bearer":["templates:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Generation id"},{"name":"thread","in":"query","schema":{"type":"boolean"},"description":"Include the earlier turns (oldest first)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateGeneration"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates/generate/{id}/save":{"post":{"tags":["Template studio"],"summary":"Save a finished generation as a template","security":[{"bearer":["templates:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Generation id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/imports":{"post":{"tags":["Imports"],"summary":"Import an existing video or ad","description":"multipart/form-data with `file` (mp4/mov) plus optional fields kind (organic|ad), title, market, language, metrics (JSON) — or JSON with url or asset_id. The video becomes an asset tagged `imported` (usable in posts) and is analysed in the background (technical analysis; with ANTHROPIC_API_KEY also format, hook, beats, CTA, pacing, what works).","security":[{"bearer":["assets:write"]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"kind":{"type":"string","enum":["organic","ad"]},"title":{"type":"string"},"market":{"type":"string"},"language":{"type":"string"},"metrics":{"type":"string","description":"JSON object"}}}},"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"asset_id":{"type":"string"},"kind":{"type":"string","enum":["organic","ad"]},"title":{"type":"string"},"market_id":{"type":"string"},"language":{"type":"string"},"metrics":{"$ref":"#/components/schemas/ImportMetrics"},"external_ref":{"type":"string"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Imports"],"summary":"List imports","security":[{"bearer":["posts:read"]}],"parameters":[{"name":"kind","in":"query","schema":{"type":"string","enum":["organic","ad"]}},{"name":"source","in":"query","schema":{"type":"string","enum":["upload","tiktok","csv"]}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"market","in":"query","schema":{"type":"string"}},{"name":"q","in":"query","schema":{"type":"string"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["recent","score"]}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Import"}}}}}}}}}},"/imports/{id}":{"get":{"tags":["Imports"],"summary":"Get an import with its analysis","security":[{"bearer":["posts:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Import id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Imports"],"summary":"Update kind, title, market, language or metrics","security":[{"bearer":["assets:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Import id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string"},"title":{"type":"string"},"market_id":{"type":["string","null"]},"language":{"type":["string","null"]},"metrics":{"$ref":"#/components/schemas/ImportMetrics"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Imports"],"summary":"Delete an import (the asset stays)","security":[{"bearer":["assets:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Import id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/imports/{id}/analyze":{"post":{"tags":["Imports"],"summary":"Run the analysis again","security":[{"bearer":["assets:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Import id"}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/imports/metrics":{"post":{"tags":["Imports"],"summary":"Upload a metrics CSV (TikTok Ads Manager, Meta Ads Manager, organic exports)","description":"Common columns are recognised (ad name, video/file name, impressions, views, clicks, CTR, spend/amount spent, conversions/results, CPA/cost per result, likes, comments, shares, average watch time, 2s/6s video views or view rates). Rows match imports by file name, then ad/video name, then id. Unmatched rows become metrics-only imports unless create_missing is false. Scores and insights update automatically.","security":[{"bearer":["assets:write"]}],"requestBody":{"required":true,"content":{"text/csv":{"schema":{"type":"string"}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"kind":{"type":"string"}}}},"application/json":{"schema":{"type":"object","required":["csv"],"properties":{"csv":{"type":"string"},"kind":{"type":"string","enum":["organic","ad"]},"create_missing":{"type":"boolean"},"market_id":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportMetricsResult"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/imports/insights":{"get":{"tags":["Imports"],"summary":"What your top performers share (scores, top/bottom, latest learnings)","security":[{"bearer":["posts:read"]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportInsights"}}}}}},"post":{"tags":["Imports"],"summary":"Recompute insights now (needs ≥3 analysed imports with metrics); writes brain notes","security":[{"bearer":["assets:write"]}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"queued":{"type":"boolean"},"needed":{"type":"integer"}}}}}}}}},"/imports/tiktok":{"post":{"tags":["Imports"],"summary":"Import videos from connected TikTok accounts","description":"Creates imports (with views/likes/comments/shares) from the account's videos: versions Lokki published (with their rendered mp4) and pre-existing videos (cover image + metrics; TikTok's API does not expose the original file).","security":[{"bearer":["assets:write"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"}}}}}},"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"queued":{"type":"integer"},"accounts":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent/settings":{"get":{"tags":["Agent"],"summary":"Get the brand agent's settings","description":"One agent per workspace; it only uses this workspace's data. Scope: posts:read.","operationId":"getAgentSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSettings"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Agent"],"summary":"Update the agent's settings","description":"Admin only. API keys need templates:write.","operationId":"updateAgentSettings","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentSettingsRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSettings"}}}},"400":{"description":"Invalid settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent/run":{"post":{"tags":["Agent"],"summary":"Run the agent now","description":"Queues a planning run (deduplicated: returns the run already queued/running). Ideas appear when it finishes — poll GET /agent/runs/{id}. Scope: posts:write.","operationId":"runAgent","responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRun"}}}},"400":{"description":"No markets yet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agent/runs":{"get":{"tags":["Agent"],"summary":"List planning runs","operationId":"listAgentRuns","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100},"description":"Default 20"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentRun"}}},"required":["data"]}}}}}}},"/api/v1/agent/runs/{id}":{"get":{"tags":["Agent"],"summary":"Get one run","operationId":"getAgentRun","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Run id (arun_…)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRun"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/ideas":{"get":{"tags":["Agent"],"summary":"List ideas","description":"Newest first. Scope: posts:read.","operationId":"listIdeas","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["new","accepted","dismissed","all"]},"description":"Default new"},{"name":"run_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Idea"}}},"required":["data"]}}}}}}},"/api/v1/ideas/{id}":{"get":{"tags":["Agent"],"summary":"Get an idea","operationId":"getIdea","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Idea id (idea_…)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Idea"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Agent"],"summary":"Edit an idea before accepting","operationId":"updateIdea","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Idea id (idea_…)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateIdeaRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Idea"}}}},"400":{"description":"Already decided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/ideas/{id}/accept":{"post":{"tags":["Agent"],"summary":"Accept an idea → create the post","description":"Creates a post (created_via \"agent\") with one version per market. Every version still goes through localization, rendering and per-market approval. Scope: posts:write.","operationId":"acceptIdea","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Idea id (idea_…)"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptIdeaRequest"}}}},"responses":{"201":{"description":"Post created","content":{"application/json":{"schema":{"type":"object","properties":{"idea":{"$ref":"#/components/schemas/Idea"},"post":{"$ref":"#/components/schemas/Post"}}}}}},"400":{"description":"Missing media, no markets, or already accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/ideas/{id}/dismiss":{"post":{"tags":["Agent"],"summary":"Dismiss an idea with a reason","description":"The reason is stored as a brain note (kind rejection) so the next batch avoids it.","operationId":"dismissIdea","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Idea id (idea_…)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissIdeaRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Idea"}}}},"400":{"description":"Reason missing or already decided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/ideas/{id}/variations":{"post":{"tags":["Agent"],"summary":"Make variations of an idea","description":"Queues a small regeneration; the new ideas carry parent_idea_id. Without an AI key: the same idea in other templates (labelled offline_variation).","operationId":"ideaVariations","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Idea id (idea_…)"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdeaVariationsRequest"}}}},"responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRun"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"lk_live_…","description":"API key. Scopes: posts:read, posts:write, assets:write, templates:read, templates:write, markets:read, approvals:write, analytics:read, webhooks:write"},"cookieAuth":{"type":"apiKey","in":"cookie","name":"lk_session","description":"Dashboard session (same-site use)"}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"Invalid request body","details":[{"path":"title","message":"Too small: expected string to have >=1 characters"}]}}}}},"RateLimited":{"description":"Too many requests","headers":{"Retry-After":{"schema":{"type":"integer"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix seconds"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"TextSlot":{"type":"object","properties":{"key":{"type":"string","description":"Slot key used in post `fields`, e.g. \"hook\", \"line1\", \"cta\""},"type":{"type":"string","const":"text"},"label":{"type":"string","description":"Human label shown in the composer and in errors"},"required":{"description":"Post creation fails when empty","type":"boolean"},"maxChars":{"description":"Hard limit checked after localization; an over-long translation blocks approval","type":"integer","exclusiveMinimum":0},"multiline":{"description":"Allow line breaks","type":"boolean"},"translate":{"description":"Default true. false keeps the source text in every market (codes, brand names)","type":"boolean"},"default":{"description":"Used when the post leaves the slot empty","type":"string"},"hint":{"description":"Guidance for the AI localizer, e.g. \"short punchy hook, max 6 words\"","type":"string"},"samples":{"description":"Example text per language code (\"en\", \"de\", …) used for previews","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["key","type","label"],"description":"A text input of the template. Its value comes from the post (source) and is localized per market."},"MediaSlot":{"type":"object","properties":{"key":{"type":"string","description":"Slot key used in post `media`, e.g. \"bg1\", \"product\""},"type":{"type":"string","const":"media"},"label":{"type":"string"},"accept":{"type":"array","items":{"type":"string","enum":["image","video"]},"description":"Which asset kinds fit this slot"},"required":{"type":"boolean"}},"required":["key","type","label","accept"],"description":"An image or video input of the template. Media is shared by all markets."},"Slot":{"oneOf":[{"$ref":"#/components/schemas/TextSlot"},{"$ref":"#/components/schemas/MediaSlot"}]},"FontStyle":{"type":"object","properties":{"family":{"type":"string","description":"Font family (built-in or one you uploaded via POST /fonts) or a brand token: \"brand.heading\", \"brand.body\""},"weight":{"description":"100..900, default 700","type":"integer","minimum":100,"maximum":900},"style":{"type":"string","enum":["normal","italic"]},"size":{"type":"number","exclusiveMinimum":0,"description":"px at a 1080 px wide canvas (scales linearly)"},"lineHeight":{"description":"Multiplier, default 1.15","type":"number","exclusiveMinimum":0},"letterSpacing":{"description":"px at 1080 wide","type":"number"},"uppercase":{"type":"boolean"},"autoFit":{"description":"Shrink the text until it fits the box (translations are often 30% longer). Never below minSize","type":"boolean"},"minSize":{"description":"Lower bound for autoFit, px at 1080 wide","type":"number","exclusiveMinimum":0},"maxLines":{"type":"integer","exclusiveMinimum":0}},"required":["family","size"],"description":"Typography of a text layer."},"AnimationName":{"type":"string","enum":["none","fade","slide-up","slide-down","slide-left","slide-right","pop","zoom","typewriter","glitch","wipe"]},"LayerAnimation":{"type":"object","properties":{"in":{"$ref":"#/components/schemas/AnimationName"},"out":{"$ref":"#/components/schemas/AnimationName"},"inDuration":{"description":"Seconds, default 0.4","type":"number","minimum":0},"outDuration":{"description":"Seconds, default 0.3","type":"number","minimum":0}}},"TextLayer":{"type":"object","properties":{"id":{"type":"string","description":"Unique within the scene"},"x":{"type":"number","description":"Left edge, fraction of canvas width (0..1)"},"y":{"type":"number","description":"Top edge, fraction of canvas height (0..1)"},"w":{"type":"number","description":"Width, fraction of canvas width"},"h":{"type":"number","description":"Height, fraction of canvas height"},"start":{"description":"Seconds from scene start (default 0)","type":"number","minimum":0},"end":{"description":"Seconds from scene start (default: scene end)","type":"number","minimum":0},"opacity":{"type":"number","minimum":0,"maximum":1},"rotation":{"description":"Degrees","type":"number"},"animation":{"$ref":"#/components/schemas/LayerAnimation"},"type":{"type":"string","const":"text"},"slot":{"description":"Text comes from this text slot…","type":"string"},"text":{"description":"…or is static. Supports {{slot}} interpolation","type":"string"},"font":{"$ref":"#/components/schemas/FontStyle"},"color":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""},"align":{"type":"string","enum":["left","center","right"]},"valign":{"type":"string","enum":["top","middle","bottom"]},"stroke":{"type":"object","properties":{"color":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""},"width":{"type":"number","minimum":0}},"required":["color","width"]},"shadow":{"type":"object","properties":{"color":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""},"blur":{"type":"number","minimum":0},"x":{"type":"number"},"y":{"type":"number"}},"required":["color","blur"]},"plate":{"description":"Background plate behind the text (TikTok caption box). mode \"lines\" = one plate per line","type":"object","properties":{"color":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""},"radius":{"type":"number"},"padX":{"type":"number"},"padY":{"type":"number"},"mode":{"type":"string","enum":["box","lines"]}},"required":["color"]},"highlightColor":{"description":"Words wrapped in *asterisks* are drawn in this colour (default brand.accent)","type":"string"},"balance":{"description":"Balance line lengths (no lonely last word). Default true when align is center","type":"boolean"}},"required":["id","x","y","w","h","type","font","color"],"description":"Draws text from a slot (localized per market) or static text."},"ImageLayer":{"type":"object","properties":{"id":{"type":"string","description":"Unique within the scene"},"x":{"type":"number","description":"Left edge, fraction of canvas width (0..1)"},"y":{"type":"number","description":"Top edge, fraction of canvas height (0..1)"},"w":{"type":"number","description":"Width, fraction of canvas width"},"h":{"type":"number","description":"Height, fraction of canvas height"},"start":{"description":"Seconds from scene start (default 0)","type":"number","minimum":0},"end":{"description":"Seconds from scene start (default: scene end)","type":"number","minimum":0},"opacity":{"type":"number","minimum":0,"maximum":1},"rotation":{"description":"Degrees","type":"number"},"animation":{"$ref":"#/components/schemas/LayerAnimation"},"type":{"type":"string","const":"image"},"slot":{"description":"A media slot (image)…","type":"string"},"src":{"description":"…or the brand logo","type":"string","const":"brand.logo"},"fit":{"type":"string","enum":["cover","contain"]},"radius":{"description":"Corner radius, px at 1080 wide","type":"number"}},"required":["id","x","y","w","h","type"],"description":"Draws an image from a media slot or the brand logo."},"ShapeLayer":{"type":"object","properties":{"id":{"type":"string","description":"Unique within the scene"},"x":{"type":"number","description":"Left edge, fraction of canvas width (0..1)"},"y":{"type":"number","description":"Top edge, fraction of canvas height (0..1)"},"w":{"type":"number","description":"Width, fraction of canvas width"},"h":{"type":"number","description":"Height, fraction of canvas height"},"start":{"description":"Seconds from scene start (default 0)","type":"number","minimum":0},"end":{"description":"Seconds from scene start (default: scene end)","type":"number","minimum":0},"opacity":{"type":"number","minimum":0,"maximum":1},"rotation":{"description":"Degrees","type":"number"},"animation":{"$ref":"#/components/schemas/LayerAnimation"},"type":{"type":"string","const":"shape"},"shape":{"type":"string","enum":["rect","circle","star"]},"color":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""},"radius":{"type":"number"},"gradient":{"description":"Gradient fill instead of color, e.g. a legibility scrim [\"rgba(0,0,0,0)\", \"rgba(0,0,0,0.6)\"]","type":"object","properties":{"colors":{"minItems":2,"type":"array","items":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""}},"angle":{"type":"number"}},"required":["colors"]}},"required":["id","x","y","w","h","type","shape","color"],"description":"A rectangle, circle or star."},"Layer":{"oneOf":[{"$ref":"#/components/schemas/TextLayer"},{"$ref":"#/components/schemas/ImageLayer"},{"$ref":"#/components/schemas/ShapeLayer"}]},"Background":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"color"},"color":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""}},"required":["type","color"]},{"type":"object","properties":{"type":{"type":"string","const":"gradient"},"colors":{"minItems":2,"type":"array","items":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""}},"angle":{"description":"Degrees","type":"number"}},"required":["type","colors"]},{"type":"object","properties":{"type":{"type":"string","const":"media"},"slot":{"type":"string","description":"Media slot key (image or video)"},"fit":{"type":"string","enum":["cover","contain"]},"kenBurns":{"description":"Slow zoom (images and videos)","type":"boolean"},"dim":{"description":"Black overlay 0..1 for legibility","type":"number","minimum":0,"maximum":1},"fallback":{"type":"string","description":"Literal colour (#RGB, #RRGGBB, #RRGGBBAA, rgb(), rgba(), hsl(), \"transparent\", \"white\", \"black\"), a brand token (\"brand.primary\", \"brand.secondary\", \"brand.accent\", \"brand.text\", \"brand.background\"), or a contrast token (\"brand.on-primary\" = black or white, whichever reads best). Hex colours and brand tokens accept an alpha suffix: \"brand.primary/0.8\", \"#000000/0.5\""}},"required":["type","slot"]}],"description":"Scene background: a colour, a gradient, or a media slot."},"Scene":{"type":"object","properties":{"id":{"type":"string"},"duration":{"type":"number","exclusiveMinimum":0,"description":"Seconds"},"background":{"$ref":"#/components/schemas/Background"},"layers":{"type":"array","items":{"$ref":"#/components/schemas/Layer"},"description":"Drawn in order (first = bottom)"},"transition":{"description":"How this scene enters from the previous one (ignored on the first). Default cut, lasts 0.35 s","type":"string","enum":["cut","fade","slide"]}},"required":["id","duration","background","layers"]},"TemplateSpec":{"type":"object","properties":{"version":{"type":"number","const":1},"width":{"type":"integer","exclusiveMinimum":0,"description":"Canvas width in px, normally 1080"},"height":{"type":"integer","exclusiveMinimum":0,"description":"Canvas height in px, normally 1920 (9:16)"},"fps":{"type":"integer","exclusiveMinimum":0,"description":"Frames per second, normally 30"},"slots":{"type":"array","items":{"$ref":"#/components/schemas/Slot"},"description":"Inputs a post fills in"},"scenes":{"minItems":1,"type":"array","items":{"$ref":"#/components/schemas/Scene"},"description":"Played in order; total duration = sum of scene durations"},"audioSlot":{"description":"Media slot key for background music (must be licensed for commercial use)","type":"string"}},"required":["version","width","height","fps","slots","scenes"],"description":"A video template. Coordinates are fractions of the canvas, font sizes are px at 1080 wide."},"MediaRef":{"anyOf":[{"type":"string","minLength":1,"description":"Asset id (ast_…) from POST /assets"},{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"http(s) URL; Lokki downloads it and creates an asset"},"filename":{"type":"string"}},"required":["url"]}],"description":"Either an asset id or { url } to import."},"VariantOverride":{"type":"object","properties":{"fields":{"description":"Slot key → your own text for this market (merged over the source fields)","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"caption":{"type":"string"},"hashtags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]}},"description":"Customer-supplied text for one market. Markets with an override skip AI localization."},"CreatePostRequest":{"type":"object","properties":{"template_id":{"type":"string","minLength":1,"description":"System template (tpl_sys_…) or one of yours"},"brand_id":{"description":"Defaults to the workspace's first brand","type":"string"},"title":{"type":"string","minLength":1,"maxLength":200,"description":"Internal title (not posted)"},"source_language":{"default":"en","type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},"fields":{"default":{},"description":"Text slot key → source text","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"media":{"description":"Media slot key → asset id or { url }","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/components/schemas/MediaRef"}},"caption":{"description":"Source caption (localized per market)","type":"string","maxLength":2200},"hashtags":{"description":"Without #; market and brand hashtags are appended","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"brief":{"description":"Extra guidance for localization, e.g. \"mention the autumn deal\"","type":"string","maxLength":2000},"markets":{"description":"Market ids, language codes, country codes, or [\"all\"] (default, unless `locations` is given)","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"locations":{"description":"Location ids, slugs or external_ids, \"all\", or a market id/language/country (= its active locations). One version per location, posted to the location's own account; locations of one market are localized once","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"overrides":{"description":"Keyed by market id, language or country code, or location id/slug/external_id","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/components/schemas/VariantOverride"}},"translate":{"description":"false = never call the AI; markets without an override get the source text","type":"boolean"},"ai_generated":{"description":"Sets TikTok's AI-generated content label","type":"boolean"},"brand_organic":{"description":"\"Promotional content\" disclosure (default off)","type":"boolean"},"schedule_at":{"description":"ISO 8601 date-time (e.g. 2026-12-01T18:00:00+01:00), Unix milliseconds, or null","type":["number","string","null"]},"external_ref":{"description":"Your id (CMS, PIM…). Idempotency key: re-sending returns the existing post","type":"string","maxLength":200},"auto_submit":{"description":"Submit for approval automatically once rendered (default: market setting)","type":"boolean"}},"required":["template_id","title"],"description":"Create a post: one idea in the source language that fans out to a variant per market."},"BulkPostsRequest":{"type":"object","properties":{"posts":{"minItems":1,"maxItems":100,"type":"array","items":{},"description":"Up to 100 CreatePostRequest objects; each is validated separately"}},"required":["posts"]},"AddMarketsRequest":{"type":"object","properties":{"markets":{"description":"Market ids, language or country codes, or [\"all\"]","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"locations":{"description":"Location ids, slugs or external_ids to add","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"overrides":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/components/schemas/VariantOverride"}}}},"UpdateVariantRequest":{"type":"object","properties":{"fields":{"description":"Slot key → text (merged). Changing text re-renders the video","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"caption":{"type":"string","maxLength":2200},"hashtags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"scheduled_at":{"description":"ISO 8601 date-time (e.g. 2026-12-01T18:00:00+01:00), Unix milliseconds, or null","type":["number","string","null"]}}},"ApproveRequest":{"type":"object","properties":{"publish_at":{"description":"\"now\" (default: the post schedule or immediately), ISO date-time or Unix ms","anyOf":[{"type":"string","const":"now"},{"type":"number"},{"type":"string"},{"type":"null"}]}}},"RejectRequest":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"description":"Why — the localizer learns from it"}},"required":["reason"]},"SkipRequest":{"type":"object","properties":{"reason":{"type":"string"}}},"RelocalizeRequest":{"type":"object","properties":{"note":{"description":"Instruction for the new attempt, e.g. \"less formal\"","type":"string","maxLength":1000}}},"CreateMarketRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"country":{"type":"string","pattern":"^[A-Za-z]{2}$"},"language":{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"brand_id":{"type":"string"},"timezone":{"description":"IANA zone, default Europe/Amsterdam","type":"string"},"notes":{"description":"Local context for the localizer","type":["string","null"]},"offers":{"description":"Approved prices/offers; the AI never invents these","type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"text":{"type":"string"},"price":{"type":"string"},"valid_until":{"type":"string"}},"required":["title","text"]}},"hashtags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"posting_times":{"description":"Local times like \"18:00\"","type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"}},"daily_post_cap":{"type":"integer","minimum":0,"maximum":15},"boost_monthly_budget":{"type":"number","minimum":0},"boost_daily_cap":{"type":"number","minimum":0},"auto_submit":{"type":"boolean"},"flag":{"type":["string","null"]}},"required":["name","country","language","currency"]},"UpdateMarketRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"country":{"type":"string","pattern":"^[A-Za-z]{2}$"},"language":{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"brand_id":{"type":"string"},"timezone":{"description":"IANA zone, default Europe/Amsterdam","type":"string"},"notes":{"description":"Local context for the localizer","type":["string","null"]},"offers":{"description":"Approved prices/offers; the AI never invents these","type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"text":{"type":"string"},"price":{"type":"string"},"valid_until":{"type":"string"}},"required":["title","text"]}},"hashtags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"posting_times":{"description":"Local times like \"18:00\"","type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"}},"daily_post_cap":{"type":"integer","minimum":0,"maximum":15},"boost_monthly_budget":{"type":"number","minimum":0},"boost_daily_cap":{"type":"number","minimum":0},"auto_submit":{"type":"boolean"},"flag":{"type":["string","null"]}}},"UpdateBrandRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"website":{"type":["string","null"]},"tone":{"type":["string","null"]},"dos":{"type":"array","items":{"type":"string"}},"donts":{"type":"array","items":{"type":"string"}},"forbidden_words":{"description":"Block approval when any slot or caption contains one","type":"array","items":{"type":"string"}},"glossary":{"description":"Terms never translated (keep) or with fixed translations per language","type":"array","items":{"type":"object","properties":{"term":{"type":"string"},"translations":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"keep":{"type":"boolean"}},"required":["term"]}},"hashtags":{"type":"array","items":{"type":"string"}},"colors":{"description":"Merged over the current colours; used by brand.* tokens","type":"object","properties":{"primary":{"type":"string"},"secondary":{"type":"string"},"accent":{"type":"string"},"text":{"type":"string"},"background":{"type":"string"}}},"fonts":{"description":"Font families for brand.heading / brand.body","type":"object","properties":{"heading":{"type":"string"},"body":{"type":"string"}}},"logo_asset_id":{"type":["string","null"]}}},"CreateTemplateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000},"category":{"type":"string","maxLength":60},"spec":{"$ref":"#/components/schemas/TemplateSpec"}},"required":["name","spec"]},"UpdateTemplateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000},"category":{"type":"string","maxLength":60},"spec":{"description":"Replacing the spec bumps the version","$ref":"#/components/schemas/TemplateSpec"}}},"DuplicateTemplateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120}}},"ImportAssetRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"http(s) URL of an image, video or audio file"},"filename":{"type":"string"}},"required":["url"]},"CreateWebhookRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"minItems":1,"type":"array","items":{"type":"string","enum":["*","variant.localized","variant.rendered","variant.pending_approval","variant.approved","variant.rejected","variant.published","variant.failed","boost.proposed","comment.received"]},"description":"Event types, or [\"*\"] for all"}},"required":["url","events"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"details":{"description":"Validation issues: [{ path, message }] or text checks"}},"required":["message"]}},"required":["error"]},"TextCheck":{"type":"object","properties":{"slot":{"type":"string"},"level":{"type":"string","enum":["error","warning"]},"message":{"type":"string"}},"required":["slot","level","message"],"description":"Errors block approval; warnings are informational."},"Variant":{"type":"object","properties":{"id":{"type":"string","description":"var_… id"},"post_id":{"type":"string","description":"post_… id"},"market_id":{"type":"string","description":"mkt_… id"},"market":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"language":{"type":"string"},"flag":{"type":["string","null"]}},"required":["id","name","country","language","flag"]},"location_id":{"description":"Set for a location's version (loc_…)","type":["string","null"]},"location":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"city":{"type":["string","null"]},"external_id":{"type":["string","null"]}},"required":["id","name","slug","city","external_id"]},{"type":"null"}]},"account_id":{"type":["string","null"]},"language":{"type":"string"},"status":{"type":"string","enum":["localizing","rendering","rendered","pending_approval","approved","publishing","published","rejected","failed","skipped"]},"status_label":{"type":"string"},"localized_by":{"anyOf":[{"type":"string","enum":["ai","offline","manual","source"]},{"type":"null"}],"description":"manual = your override, source = untranslated source text"},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"caption":{"type":"string"},"hashtags":{"type":"array","items":{"type":"string"}},"checks":{"type":"array","items":{"$ref":"#/components/schemas/TextCheck"}},"edited":{"type":"boolean"},"scheduled_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]},"approval_id":{"type":["string","null"]},"post_url":{"type":["string","null"]},"tiktok_video_id":{"type":["string","null"]},"published_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]},"error":{"type":["string","null"]},"render_error":{"type":["string","null"]},"preview_url":{"description":"Thumbnail: /api/assets/:id/file (same auth as the API)","type":["string","null"]},"video_url":{"description":"Rendered mp4: /api/assets/:id/file (supports Range)","type":["string","null"]},"metrics":{"type":"object","properties":{"views":{"type":"number"},"likes":{"type":"number"},"comments":{"type":"number"},"shares":{"type":"number"},"avg_watch_time":{"type":["number","null"]},"baseline_ratio":{"description":"Views vs the account's usual","type":["number","null"]},"is_winner":{"type":"boolean"},"synced_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]}},"required":["views","likes","comments","shares","avg_watch_time","baseline_ratio","is_winner","synced_at"]},"links":{"type":"object","properties":{"self":{"type":"string"},"post":{"type":"string"},"dashboard":{"type":"string"}},"required":["self","post","dashboard"]},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"updated_at":{"type":"integer","description":"Unix time in milliseconds"}},"required":["id","post_id","market_id","market","location_id","location","account_id","language","status","status_label","localized_by","fields","caption","hashtags","checks","edited","scheduled_at","approval_id","post_url","tiktok_video_id","published_at","error","render_error","preview_url","video_url","metrics","links","created_at","updated_at"],"description":"One market's version of a post."},"Post":{"type":"object","properties":{"id":{"type":"string","description":"post_… id"},"title":{"type":"string"},"template_id":{"type":"string"},"brand_id":{"type":"string"},"source_language":{"type":"string"},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"media":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"Media slot key → asset id"},"caption":{"type":"string"},"hashtags":{"type":"array","items":{"type":"string"}},"brief":{"type":["string","null"]},"status":{"type":"string"},"external_ref":{"type":["string","null"]},"created_via":{"type":"string","enum":["ui","api","csv"]},"ai_generated":{"type":"boolean"},"brand_organic":{"type":"boolean"},"schedule_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"updated_at":{"type":"integer","description":"Unix time in milliseconds"},"summary":{"type":"object","properties":{"markets":{"type":"number"},"by_status":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}},"required":["markets","by_status"]},"metrics":{"type":"object","properties":{"views":{"type":"number"},"likes":{"type":"number"},"comments":{"type":"number"},"shares":{"type":"number"}},"required":["views","likes","comments","shares"]},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"links":{"type":"object","properties":{"self":{"type":"string"},"dashboard":{"type":"string"}},"required":["self","dashboard"]}},"required":["id","title","template_id","brand_id","source_language","fields","media","caption","hashtags","brief","status","external_ref","created_via","ai_generated","brand_organic","schedule_at","created_at","updated_at","summary","metrics","variants","links"],"description":"A post with all its market variants."},"PostListItem":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"template_id":{"type":"string"},"source_language":{"type":"string"},"external_ref":{"type":["string","null"]},"created_via":{"type":"string"},"schedule_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"markets":{"type":"number"},"variant_counts":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"views":{"type":"number"},"preview_url":{"type":["string","null"]},"links":{"type":"object","properties":{"self":{"type":"string"}},"required":["self"]}},"required":["id","title","template_id","source_language","external_ref","created_via","schedule_at","created_at","markets","variant_counts","views","preview_url","links"]},"PostList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PostListItem"}},"has_more":{"type":"boolean"},"next_cursor":{"description":"Pass as ?cursor= to get the next page","type":["string","null"]},"limit":{"type":"number"}},"required":["data","has_more","next_cursor","limit"]},"CreatePostResponse":{"type":"object","properties":{"idempotent":{"type":"boolean","description":"true when a post with this external_ref already existed (HTTP 200 instead of 201)"},"post":{"$ref":"#/components/schemas/Post"}},"required":["idempotent","post"]},"BulkPostsResponse":{"type":"object","properties":{"summary":{"type":"object","properties":{"total":{"type":"number"},"created":{"type":"number"},"existing":{"type":"number"},"failed":{"type":"number"}},"required":["total","created","existing","failed"]},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number"},"status":{"type":"number","description":"HTTP status this item would have had alone"},"ok":{"type":"boolean"},"idempotent":{"type":"boolean"},"post":{"$ref":"#/components/schemas/Post"},"error":{"type":"object","properties":{"message":{"type":"string"},"details":{"description":"Validation issues: [{ path, message }] or text checks"}},"required":["message"]}},"required":["index","status","ok"]}}},"required":["summary","results"]},"Market":{"type":"object","properties":{"id":{"type":"string","description":"mkt_… id"},"brand_id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"language":{"type":"string"},"currency":{"type":"string"},"timezone":{"type":"string"},"notes":{"type":["string","null"]},"offers":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"text":{"type":"string"},"price":{"type":"string"},"valid_until":{"type":"string"}},"required":["title","text"]}},"hashtags":{"type":"array","items":{"type":"string"}},"posting_times":{"type":"array","items":{"type":"string"}},"daily_post_cap":{"type":"number"},"boost_monthly_budget":{"type":"number"},"boost_daily_cap":{"type":"number"},"auto_submit":{"type":"boolean"},"flag":{"type":["string","null"]},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"username":{"type":["string","null"]},"status":{"type":"string"}},"required":["id","username","status"]},{"type":"null"}]}},"required":["id","brand_id","name","country","language","currency","timezone","notes","offers","hashtags","posting_times","daily_post_cap","boost_monthly_budget","boost_daily_cap","auto_submit","flag","created_at"]},"Account":{"type":"object","properties":{"id":{"type":"string","description":"acc_… id"},"market_id":{"type":["string","null"]},"open_id":{"type":"string"},"username":{"type":["string","null"]},"display_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"followers":{"type":"number"},"likes":{"type":"number"},"videos_count":{"type":"number"},"status":{"type":"string","enum":["connected","needs_reconnect","disconnected"]},"bc_linked":{"type":"boolean"},"last_synced_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]},"created_at":{"type":"integer","description":"Unix time in milliseconds"}},"required":["id","market_id","open_id","username","display_name","avatar_url","followers","likes","videos_count","status","bc_linked","last_synced_at","created_at"],"description":"A connected TikTok Business account. Connect accounts in the dashboard (OAuth)."},"Brand":{"type":"object","properties":{"id":{"type":"string","description":"brd_… id"},"name":{"type":"string"},"website":{"type":["string","null"]},"tone":{"type":["string","null"]},"dos":{"type":"array","items":{"type":"string"}},"donts":{"type":"array","items":{"type":"string"}},"forbidden_words":{"type":"array","items":{"type":"string"}},"glossary":{"type":"array","items":{"type":"object","properties":{"term":{"type":"string"},"translations":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"keep":{"type":"boolean"}},"required":["term"]}},"hashtags":{"type":"array","items":{"type":"string"}},"colors":{"type":"object","properties":{"primary":{"type":"string"},"secondary":{"type":"string"},"accent":{"type":"string"},"text":{"type":"string"},"background":{"type":"string"}},"required":["primary","secondary","accent","text","background"]},"fonts":{"type":"object","properties":{"heading":{"type":"string"},"body":{"type":"string"}},"required":["heading","body"]},"logo_asset_id":{"type":["string","null"]},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"updated_at":{"type":"integer","description":"Unix time in milliseconds"}},"required":["id","name","website","tone","dos","donts","forbidden_words","glossary","hashtags","colors","fonts","logo_asset_id","created_at","updated_at"]},"Template":{"type":"object","properties":{"id":{"type":"string","description":"tpl_… id"},"name":{"type":"string"},"description":{"type":["string","null"]},"category":{"type":"string"},"spec":{"$ref":"#/components/schemas/TemplateSpec"},"version":{"type":"number"},"archived":{"type":"boolean"},"is_system":{"type":"boolean","description":"System templates are read-only; duplicate to customise"},"thumbnail_url":{"type":["string","null"]},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"updated_at":{"type":"integer","description":"Unix time in milliseconds"}},"required":["id","name","description","category","spec","version","archived","is_system","thumbnail_url","created_at","updated_at"]},"Font":{"type":"object","properties":{"id":{"type":"string","description":"fnt_… id"},"family":{"type":"string"},"weight":{"type":"number"},"style":{"type":"string"},"source":{"type":"string","enum":["builtin","upload"]},"builtin":{"type":"boolean"},"url":{"type":"string","description":"/api/fonts/:id/file"},"created_at":{"type":"integer","description":"Unix time in milliseconds"}},"required":["id","family","weight","style","source","builtin","url","created_at"]},"Asset":{"type":"object","properties":{"id":{"type":"string","description":"ast_… id"},"kind":{"type":"string","enum":["image","video","font","audio","render","thumbnail","logo"]},"filename":{"type":"string"},"mime":{"type":"string"},"size":{"type":"number"},"sha256":{"type":["string","null"]},"width":{"type":["number","null"]},"height":{"type":["number","null"]},"duration":{"type":["number","null"]},"url":{"type":"string","description":"/api/assets/:id/file"},"created_at":{"type":"integer","description":"Unix time in milliseconds"}},"required":["id","kind","filename","mime","size","sha256","width","height","duration","url","created_at"]},"PendingApproval":{"type":"object","properties":{"id":{"type":"string","description":"apr_… id"},"variant_id":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"payload":{"type":"object","properties":{"account_id":{"type":"string"},"video_sha256":{"type":"string"},"caption":{"type":"string","description":"Final caption incl. hashtags, exactly as it will be posted"},"brand_organic":{"type":"boolean"},"ai_generated":{"type":"boolean"},"scheduled_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]}},"required":["account_id","video_sha256","caption","brand_organic","ai_generated","scheduled_at"],"description":"Exactly what will be posted (hash-locked)"},"market":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"language":{"type":"string"},"flag":{"type":["string","null"]}},"required":["id","name","country","language","flag"]},"post":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"}},"required":["id","title"]},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"username":{"type":["string","null"]}},"required":["id","username"]},{"type":"null"}]},"preview_url":{"type":["string","null"]},"video_url":{"type":["string","null"]},"links":{"type":"object","properties":{"approve":{"type":"string"},"reject":{"type":"string"},"variant":{"type":"string"}},"required":["approve","reject","variant"]}},"required":["id","variant_id","status","created_at","payload","market","post","account","preview_url","video_url","links"]},"Webhook":{"type":"object","properties":{"id":{"type":"string","description":"whk_… id"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"created_at":{"type":"integer","description":"Unix time in milliseconds"},"secret":{"description":"Only returned once, on creation. Used to verify Lokki-Signature","type":"string"}},"required":["id","url","events","active","created_at"]},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","description":"Delivery id (whd_…); use it to de-duplicate retries"},"type":{"type":"string","enum":["ping","variant.localized","variant.rendered","variant.pending_approval","variant.approved","variant.rejected","variant.published","variant.failed","boost.proposed","comment.received"]},"created_at":{"type":"string","description":"ISO 8601"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type","created_at","data"],"description":"Body Lokki POSTs to your webhook URL."},"Me":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"}},"required":["id","name","slug","plan"]},"auth":{"type":"object","properties":{"type":{"type":"string","enum":["api_key","user"]},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"last_used_at":{"anyOf":[{"type":"integer","description":"Unix time in milliseconds"},{"type":"null"}]}},"required":["id","name","prefix","last_used_at"]},"scopes":{"type":"array","items":{"type":"string"}},"user":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"}},"required":["id","role"]}},"required":["type","scopes"]},"rate_limit":{"type":"object","properties":{"limit":{"type":"number"},"window_seconds":{"type":"number"}},"required":["limit","window_seconds"]}},"required":["workspace","auth","rate_limit"]},"CsvImportResult":{"type":"object","properties":{"dry_run":{"type":"boolean"},"delimiter":{"type":"string"},"columns":{"type":"array","items":{"type":"string"}},"unknown_columns":{"type":"array","items":{"type":"string"}},"summary":{"type":"object","properties":{"rows":{"type":"number"},"ok":{"type":"number"},"created":{"type":"number"},"existing":{"type":"number"},"failed":{"type":"number"}},"required":["rows","ok","created","existing","failed"]},"rows":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"line":{"type":"number"},"ok":{"type":"boolean"},"status":{"type":"string","enum":["created","existing","valid","error"]},"post_id":{"type":"string"},"variants":{"type":"number"},"errors":{"type":"array","items":{"type":"string"}}},"required":["row","line","ok","status","errors"]}}},"required":["dry_run","delimiter","columns","unknown_columns","summary","rows"]},"AnalyticsOverview":{"type":"object","properties":{"days":{"type":"number"},"pipeline":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"},"description":"Variant count per status"},"totals":{"type":"object","properties":{"posts":{"type":"number"},"views":{"type":"number"},"likes":{"type":"number"},"comments":{"type":"number"},"shares":{"type":"number"}},"required":["posts","views","likes","comments","shares"]},"prev":{"type":"object","properties":{"posts":{"type":"number"},"views":{"type":"number"},"likes":{"type":"number"}},"required":["posts","views","likes"],"description":"Same totals for the previous period"},"followers":{"type":"number"},"spend":{"type":"number"},"markets":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"timeseries":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","number"]}},"description":"Daily views per market id"}},"required":["days","pipeline","totals","prev","followers","spend","markets","timeseries"]},"LocationFact":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":80,"description":"Shown to the AI and usable as {{location.fact.<label>}}, e.g. \"Pool\""},"value":{"type":"string","minLength":1,"maxLength":500,"description":"Approved wording, e.g. \"heated, open May–Sept\""}},"required":["label","value"],"description":"An approved fact the AI and templates may use."},"LocationOffer":{"type":"object","properties":{"title":{"type":"string"},"text":{"type":"string"},"price":{"type":"string"},"valid_until":{"description":"YYYY-MM-DD","type":"string"}},"required":["title","text"],"description":"Same shape as market offers. A location's valid offers win over the market's for {{offer.*}}."},"Location":{"type":"object","properties":{"id":{"type":"string","description":"loc_… id"},"market_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"city":{"type":["string","null"]},"region":{"type":["string","null"]},"address":{"type":["string","null"]},"timezone":{"type":["string","null"]},"phone":{"type":["string","null"]},"website":{"type":["string","null"]},"opening_hours":{"type":["string","null"]},"notes":{"type":["string","null"]},"facts":{"type":"array","items":{"$ref":"#/components/schemas/LocationFact"}},"offers":{"type":"array","items":{"$ref":"#/components/schemas/LocationOffer"}},"hashtags":{"type":"array","items":{"type":"string"}},"external_id":{"type":["string","null"]},"active":{"type":"boolean"},"created_at":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Unix time in milliseconds"},"updated_at":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Unix time in milliseconds"},"market":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"language":{"type":"string"},"flag":{"type":["string","null"]}},"required":["id","name","country","language","flag"]},{"type":"null"}]},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"username":{"type":["string","null"]},"status":{"type":"string"}},"required":["id","username","status"]},{"type":"null"}]},"variables":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"Resolved {{variable}} values for this location's versions"}},"required":["id","market_id","name","slug","city","region","address","timezone","phone","website","opening_hours","notes","facts","offers","hashtags","external_id","active","created_at","updated_at","market","account","variables"],"description":"A park, hotel, club, store… under a market, optionally with its own TikTok account."},"CreateLocationRequest":{"type":"object","properties":{"market_id":{"type":"string","minLength":1,"description":"The market this location belongs to (inherits language, currency, hashtags)"},"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"description":"URL-safe handle; generated from the name when omitted. Unique per workspace","type":"string","maxLength":60},"city":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"region":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"address":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"timezone":{"description":"IANA zone; overrides the market timezone","anyOf":[{"type":"string","maxLength":60},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"website":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"opening_hours":{"description":"Free text","anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"notes":{"description":"Context for people (not posted)","anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]},"facts":{"maxItems":50,"type":"array","items":{"$ref":"#/components/schemas/LocationFact"}},"offers":{"maxItems":20,"type":"array","items":{"$ref":"#/components/schemas/LocationOffer"}},"hashtags":{"description":"Without #; added to this location's versions","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"external_id":{"description":"Your id (CRM, PMS, POS). Unique per workspace; matched on CSV import","anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"active":{"description":"Inactive locations can't be targeted by new posts","type":"boolean"}},"required":["market_id","name"],"description":"Create a location under a market."},"UpdateLocationRequest":{"type":"object","properties":{"market_id":{"description":"Move to another market (only while the location has no posts)","type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"description":"URL-safe handle; generated from the name when omitted. Unique per workspace","type":"string","maxLength":60},"city":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"region":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"address":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"timezone":{"description":"IANA zone; overrides the market timezone","anyOf":[{"type":"string","maxLength":60},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"website":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"opening_hours":{"description":"Free text","anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"notes":{"description":"Context for people (not posted)","anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]},"facts":{"maxItems":50,"type":"array","items":{"$ref":"#/components/schemas/LocationFact"}},"offers":{"maxItems":20,"type":"array","items":{"$ref":"#/components/schemas/LocationOffer"}},"hashtags":{"description":"Without #; added to this location's versions","anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"external_id":{"description":"Your id (CRM, PMS, POS). Unique per workspace; matched on CSV import","anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"active":{"description":"Inactive locations can't be targeted by new posts","type":"boolean"}},"description":"Partial update; omitted fields are kept."},"ImportLocationsRequest":{"type":"object","properties":{"csv":{"type":"string","minLength":1,"description":"CSV text with a header row"},"market_id":{"description":"Market for rows without a market column","type":"string"},"dry_run":{"description":"Validate only","type":"boolean"},"update":{"description":"Update existing locations (matched by external_id, then slug). Default true","type":"boolean"}},"required":["csv"]},"LocationImportResult":{"type":"object","properties":{"dry_run":{"type":"boolean"},"created":{"type":"number"},"updated":{"type":"number"},"skipped":{"type":"number"},"rows":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number","description":"1-based line number in the CSV"},"action":{"type":"string","enum":["create","update","skip","error"]},"id":{"type":"string"},"name":{"type":"string"},"error":{"type":"string"}},"required":["row","action"]}},"columns":{"type":"object","properties":{"recognized":{"type":"array","items":{"type":"string"}},"ignored":{"type":"array","items":{"type":"string"}}},"required":["recognized","ignored"]}},"required":["dry_run","created","updated","skipped","rows","columns"]},"TemplateGeneration":{"type":"object","description":"One turn of the template studio. Poll until status is done or failed.","properties":{"id":{"type":"string","description":"gen_… id"},"status":{"type":"string","enum":["queued","running","done","failed"]},"provider":{"type":["string","null"],"enum":["ai","preset",null],"description":"\"preset\" = built offline from the closest system template (no ANTHROPIC_API_KEY); never presented as AI"},"model":{"type":["string","null"]},"prompt":{"type":"string"},"name":{"type":["string","null"]},"description":{"type":["string","null"]},"category":{"type":["string","null"]},"spec":{"oneOf":[{"$ref":"#/components/schemas/TemplateSpec"},{"type":"null"}],"description":"Validated template spec (brand tokens, text inside the TikTok safe zone)"},"notes":{"type":"array","items":{"type":"string"},"description":"What was done / design notes"},"warnings":{"type":"array","items":{"type":"string"},"description":"Automatic fixes and text-fit problems"},"previews":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","enum":["start","middle","end"]},"url":{"type":"string"}}},"description":"PNG frames rendered with sample text and your brand"},"base_template_id":{"type":["string","null"]},"reference_import_id":{"type":["string","null"]},"parent_id":{"type":["string","null"]},"template_id":{"type":["string","null"],"description":"Set once saved as a template"},"options":{"type":"object","properties":{"aspect":{"type":"string"},"length":{"type":"number"}}},"error":{"type":["string","null"]},"created_at":{"type":"integer"},"updated_at":{"type":"integer"}}},"GenerateTemplateRequest":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","maxLength":2000},"base_template_id":{"type":"string"},"reference_import_id":{"type":"string"},"parent_id":{"type":"string"},"aspect":{"type":"string","enum":["9:16","1:1","4:5"]},"length":{"type":"number","minimum":3,"maximum":120}}},"ImportMetrics":{"type":"object","description":"Normalised metrics (rates in percent)","properties":{"impressions":{"type":"number"},"views":{"type":"number"},"reach":{"type":"number"},"clicks":{"type":"number"},"ctr":{"type":"number"},"spend":{"type":"number"},"conversions":{"type":"number"},"cpa":{"type":"number"},"likes":{"type":"number"},"comments":{"type":"number"},"shares":{"type":"number"},"watch_time":{"type":"number"},"views_2s":{"type":"number"},"views_6s":{"type":"number"},"view_rate_2s":{"type":"number"},"view_rate_6s":{"type":"number"},"engagement_rate":{"type":"number"}}},"Import":{"type":"object","properties":{"id":{"type":"string","description":"imp_… id"},"kind":{"type":"string","enum":["organic","ad"]},"source":{"type":"string","enum":["upload","tiktok","csv"]},"status":{"type":"string","enum":["queued","analyzing","analyzed","failed","metrics_only"]},"title":{"type":"string"},"filename":{"type":["string","null"]},"market_id":{"type":["string","null"]},"language":{"type":["string","null"]},"account_id":{"type":["string","null"]},"metrics":{"$ref":"#/components/schemas/ImportMetrics"},"score":{"type":["number","null"],"description":"0-100, normalised per kind: ads by CTR/CPA, organic by views/engagement. Null until ≥2 of a kind have metrics"},"asset":{"type":["object","null"],"properties":{"id":{"type":"string"},"url":{"type":"string"}},"description":"The video, reusable as media in posts (tagged imported)"},"thumbnail_url":{"type":["string","null"]},"analysis":{"type":["object","null"],"properties":{"provider":{"type":"string","enum":["ai","technical"]},"technical":{"type":"object","description":"duration, width, height, aspect, fps, has_audio, scene_cuts, cuts_per_10s, avg_shot_length, brightness, brightness_label"},"ai":{"type":["object","null"],"description":"format, hook {seconds, visual, text, why}, beats[], cta, language, text_density, pacing, text_style, what_works[], risks[], template_idea"},"note":{"type":"string"},"frames":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"}}}}}},"external_ref":{"type":["string","null"]},"error":{"type":["string","null"]},"created_at":{"type":"integer"},"updated_at":{"type":"integer"}}},"ImportMetricsResult":{"type":"object","properties":{"rows":{"type":"integer"},"columns":{"type":"object","additionalProperties":{"type":"string"},"description":"CSV column → recognised field"},"matched":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"import_id":{"type":"string"},"title":{"type":"string"},"by":{"type":"string","enum":["file","name","ref"]}}}},"created":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"import_id":{"type":"string"},"title":{"type":"string"}}}},"unmatched":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"name":{"type":"string"}}}},"skipped":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"reason":{"type":"string"}}}}}},"ImportInsights":{"type":"object","properties":{"eligible":{"type":"boolean","description":"≥3 analysed imports with metrics"},"needed":{"type":"integer"},"scored":{"type":"integer"},"analyzed":{"type":"integer"},"total":{"type":"integer"},"pending":{"type":"boolean"},"top":{"type":"array","items":{"$ref":"#/components/schemas/Import"}},"bottom":{"type":"array","items":{"$ref":"#/components/schemas/Import"}},"latest":{"type":["object","null"],"properties":{"provider":{"type":"string","enum":["ai","technical"]},"created_at":{"type":"integer"},"import_count":{"type":"integer"},"summary":{"type":"string"},"insights":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"market_id":{"type":"string"},"confidence":{"type":"string"}}}},"template_prompt":{"type":"string"}}}}},"AgentSettings":{"type":"object","properties":{"enabled":{"type":"boolean"},"cadence":{"type":"string","enum":["weekly","twice_weekly"]},"run_days":{"type":"array","items":{"type":"number"}},"run_time":{"type":"string"},"timezone":{"type":"string"},"ideas_per_market":{"type":"number"},"allowed_template_ids":{"type":"array","items":{"type":"string"}},"experiment_share":{"type":"number"},"mode":{"type":"string","enum":["ideas","drafts"]},"instructions":{"type":["string","null"]},"source_language":{"type":"string"},"next_run_at":{"type":["number","null"]},"last_run_at":{"type":["number","null"]},"ai_configured":{"type":"boolean"}},"required":["enabled","cadence","run_days","run_time","timezone","ideas_per_market","allowed_template_ids","experiment_share","mode","instructions","source_language","next_run_at","last_run_at","ai_configured"]},"UpdateAgentSettingsRequest":{"type":"object","properties":{"enabled":{"description":"Plan automatically on the schedule","type":"boolean"},"cadence":{"type":"string","enum":["weekly","twice_weekly"]},"run_days":{"description":"Weekdays, 0 = Sunday … 6 = Saturday (1 for weekly, 2 for twice weekly)","maxItems":2,"type":"array","items":{"type":"integer","minimum":0,"maximum":6}},"run_time":{"description":"Local time HH:MM","type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"description":"IANA timezone, e.g. Europe/Amsterdam","type":"string","minLength":1},"ideas_per_market":{"type":"integer","minimum":1,"maximum":10},"allowed_template_ids":{"description":"Empty = every template","type":"array","items":{"type":"string"}},"experiment_share":{"description":"Share of ideas that test something new (0.2 = one in five)","type":"number","minimum":0,"maximum":1},"mode":{"description":"ideas: HQ accepts each idea; drafts: ideas become posts automatically (still approved per market)","type":"string","enum":["ideas","drafts"]},"instructions":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"source_language":{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"}},"additionalProperties":false},"AgentRun":{"type":"object","properties":{"id":{"type":"string"},"trigger":{"type":"string","enum":["schedule","manual","onboarding","variations","api"]},"status":{"type":"string","enum":["queued","running","done","failed"]},"engine":{"anyOf":[{"type":"string","enum":["ai","offline"]},{"type":"null"}]},"model":{"type":["string","null"]},"parent_idea_id":{"type":["string","null"]},"ideas_count":{"type":"number"},"rejected_count":{"type":"number"},"learnings_count":{"type":"number"},"summary":{"type":["string","null"]},"error":{"type":["string","null"]},"stats":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"number"},"started_at":{"type":["number","null"]},"finished_at":{"type":["number","null"]}},"required":["id","trigger","status","engine","model","parent_idea_id","ideas_count","rejected_count","learnings_count","summary","error","stats","created_at","started_at","finished_at"]},"Idea":{"type":"object","properties":{"id":{"type":"string"},"run_id":{"type":["string","null"]},"parent_idea_id":{"type":["string","null"]},"status":{"type":"string","enum":["new","accepted","dismissed"]},"source":{"type":"string","enum":["ai","offline_remix","offline_offer","offline_evergreen","offline_variation"],"description":"offline_* = rule-based, no AI"},"title":{"type":"string"},"angle":{"type":["string","null"]},"rationale":{"type":["string","null"]},"experiment":{"type":"boolean"},"template_id":{"type":"string"},"market_ids":{"type":"array","items":{"type":"string"}},"location_ids":{"type":"array","items":{"type":"string"}},"source_language":{"type":"string"},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"media":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"caption":{"type":"string"},"hashtags":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"object","properties":{"slot":{"type":"string"},"level":{"type":"string","enum":["error","warning","info"]},"message":{"type":"string"}},"required":["slot","level","message"]}},"origin":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"post_id":{"type":["string","null"]},"decided_at":{"type":["number","null"]},"dismiss_reason":{"type":["string","null"]},"created_at":{"type":"number"},"updated_at":{"type":"number"},"links":{"type":"object","properties":{"self":{"type":"string"},"post":{"type":["string","null"]},"dashboard":{"type":"string"}},"required":["self","post","dashboard"]}},"required":["id","run_id","parent_idea_id","status","source","title","angle","rationale","experiment","template_id","market_ids","location_ids","source_language","fields","media","caption","hashtags","warnings","origin","post_id","decided_at","dismiss_reason","created_at","updated_at","links"]},"AcceptIdeaRequest":{"type":"object","properties":{"market_ids":{"description":"Defaults to the idea's markets","minItems":1,"type":"array","items":{"type":"string"}},"location_ids":{"type":"array","items":{"type":"string"}},"title":{"type":"string","minLength":1,"maxLength":200},"template_id":{"type":"string"},"fields":{"description":"Text slot overrides (source language)","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"media":{"description":"Media slot key → asset id","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"caption":{"type":"string","maxLength":2200},"hashtags":{"maxItems":12,"type":"array","items":{"type":"string"}}},"additionalProperties":false},"UpdateIdeaRequest":{"type":"object","properties":{"market_ids":{"description":"Defaults to the idea's markets","minItems":1,"type":"array","items":{"type":"string"}},"location_ids":{"type":"array","items":{"type":"string"}},"title":{"type":"string","minLength":1,"maxLength":200},"fields":{"description":"Text slot overrides (source language)","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"media":{"description":"Media slot key → asset id","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"caption":{"type":"string","maxLength":2200},"hashtags":{"maxItems":12,"type":"array","items":{"type":"string"}}},"additionalProperties":false},"DismissIdeaRequest":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"description":"Why — stored in the brain so the agent learns"}},"required":["reason"]},"IdeaVariationsRequest":{"type":"object","properties":{"count":{"type":"integer","minimum":1,"maximum":5},"note":{"description":"What to change, e.g. \"shorter hooks\"","type":"string","maxLength":500}}}}},"webhooks":{"variantEvent":{"post":{"summary":"Variant/boost/comment events","description":"Lokki POSTs this to your webhook URL. Verify `Lokki-Signature: t=<unix>,v1=<sig>` where sig = base64url(HMAC-SHA256(secret, `${t}.${rawBody}`)).","parameters":[{"name":"Lokki-Signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"whd_8Kq2Lm0Zx7Pw1A","type":"variant.published","created_at":"2026-11-17T18:00:04.512Z","data":{"variant_id":"var_de9Fk2LmQx81","post_id":"post_7f3k2Qx9Lm2Ab","market_id":"mkt_de4Gh7Ns2Kd","language":"de","status":"published","post_url":"https://www.tiktok.com/@wildcamp.de/video/7412345678901234567","error":null}}}}},"responses":{"200":{"description":"Return any 2xx within 10 s"}}}}}}