{"openapi":"3.1.0","info":{"title":"Dispatchlet API","version":"1","description":"Automate Dispatchlet: list and change automations, start runs, read the log, approve drafts, manage webhooks. Tokens come from Settings; see https://dispatchlet.com/docs/api.","contact":{"email":"barry@dispatchlet.com"}},"servers":[{"url":"https://dispatchlet.com/api/v1"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"dl_… from Settings → API tokens"}},"schemas":{"Cadence":{"type":"object","required":["preset","time"],"properties":{"preset":{"type":"string","enum":["daily","weekly"]},"time":{"type":"string","description":"HH:MM in the account time zone","example":"08:00"},"weekday":{"anyOf":[{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},{"type":"null"}]}}},"PublicationPlan":{"type":"object","description":"For postingMode planned: one story per chosen local day at this local time, for the seven days from each run. Requires a weekly cadence.","properties":{"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"weekdays":{"type":"array","items":{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},"minItems":1}},"required":["time","weekdays"]},"Setup":{"type":"object","required":["research","cadence"],"properties":{"research":{"type":"string","maxLength":300,"description":"What to research, one line"},"avoid":{"type":"string","maxLength":500,"default":""},"sources":{"type":"array","items":{"type":"string"},"maxItems":10,"default":[]},"onlyTheseSources":{"type":"boolean","default":false},"cadence":{"type":"object","required":["preset","time"],"properties":{"preset":{"type":"string","enum":["daily","weekly"]},"time":{"type":"string","description":"HH:MM in the account time zone","example":"08:00"},"weekday":{"anyOf":[{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},{"type":"null"}]}}},"maxStories":{"type":"integer","minimum":1,"maximum":3,"default":3},"postingMode":{"type":"string","enum":["draft","queue"],"default":"draft"}}},"Automation":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"name":{"type":"string"},"status":{"type":"string","enum":["generating","ready","active","paused","failed"]},"cadence":{"type":"object","required":["preset","time"],"properties":{"preset":{"type":"string","enum":["daily","weekly"]},"time":{"type":"string","description":"HH:MM in the account time zone","example":"08:00"},"weekday":{"anyOf":[{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},{"type":"null"}]}}},"timezone":{"type":"string"},"postingMode":{"type":"string","enum":["draft","queue","spread","planned"]},"maxPostsPerRun":{"type":"integer"},"publicationPlan":{"anyOf":[{"type":"object","description":"For postingMode planned: one story per chosen local day at this local time, for the seven days from each run. Requires a weekly cadence.","properties":{"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"weekdays":{"type":"array","items":{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},"minItems":1}},"required":["time","weekdays"]},{"type":"null"}]},"researchMode":{"type":"string","enum":["recent","archive","anniversary"]},"channelIds":{"type":"array","items":{"type":"string"}},"nextRunAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"lastRunAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"generationError":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"integer","description":"The playbook version in use"}}},"AutomationDetail":{"allOf":[{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"name":{"type":"string"},"status":{"type":"string","enum":["generating","ready","active","paused","failed"]},"cadence":{"type":"object","required":["preset","time"],"properties":{"preset":{"type":"string","enum":["daily","weekly"]},"time":{"type":"string","description":"HH:MM in the account time zone","example":"08:00"},"weekday":{"anyOf":[{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},{"type":"null"}]}}},"timezone":{"type":"string"},"postingMode":{"type":"string","enum":["draft","queue","spread","planned"]},"maxPostsPerRun":{"type":"integer"},"publicationPlan":{"anyOf":[{"type":"object","description":"For postingMode planned: one story per chosen local day at this local time, for the seven days from each run. Requires a weekly cadence.","properties":{"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"weekdays":{"type":"array","items":{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},"minItems":1}},"required":["time","weekdays"]},{"type":"null"}]},"researchMode":{"type":"string","enum":["recent","archive","anniversary"]},"channelIds":{"type":"array","items":{"type":"string"}},"nextRunAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"lastRunAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"generationError":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"integer","description":"The playbook version in use"}}},{"type":"object","properties":{"setup":{"type":"object","required":["research","cadence"],"properties":{"research":{"type":"string","maxLength":300,"description":"What to research, one line"},"avoid":{"type":"string","maxLength":500,"default":""},"sources":{"type":"array","items":{"type":"string"},"maxItems":10,"default":[]},"onlyTheseSources":{"type":"boolean","default":false},"cadence":{"type":"object","required":["preset","time"],"properties":{"preset":{"type":"string","enum":["daily","weekly"]},"time":{"type":"string","description":"HH:MM in the account time zone","example":"08:00"},"weekday":{"anyOf":[{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"]},{"type":"null"}]}}},"maxStories":{"type":"integer","minimum":1,"maximum":3,"default":3},"postingMode":{"type":"string","enum":["draft","queue"],"default":"draft"}}},"playbook":{"anyOf":[{"type":"object","description":"The structured playbook"},{"type":"null"}]},"text":{"anyOf":[{"type":"string","description":"The playbook as text"},{"type":"null"}]},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}}}}]},"Channel":{"type":"object","properties":{"id":{"type":"string","description":"Buffer's channel id"},"service":{"type":"string","enum":["twitter","linkedin","threads","bluesky","mastodon"]},"name":{"type":"string"},"usable":{"type":"boolean"},"supported":{"type":"boolean"},"problem":{"anyOf":[{"type":"string","enum":["locked","disconnected","unsupported"]},{"type":"null"}]},"maxLength":{"anyOf":[{"type":"integer"},{"type":"null"}]},"syncedAt":{"type":"integer","description":"Unix milliseconds"}}},"Hint":{"type":"object","required":["title"],"properties":{"title":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","format":"uri","maxLength":500,"description":"http or https only"},"notes":{"type":"string","maxLength":1000}},"description":"A story the run must cover. Dedupe still applies."},"RunSummary":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"kind":{"type":"string","enum":["scheduled","now","dry"]},"status":{"type":"string","enum":["researching","writing","publishing","done","failed","skipped"]},"startedAt":{"type":"integer","description":"Unix milliseconds"},"finishedAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"found":{"type":"integer"},"kept":{"type":"integer"},"posted":{"type":"integer"},"costUsd":{"type":"number"},"last":{"type":"string","description":"The latest log line"}}},"Run":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"automationId":{"type":"string","description":"A Dispatchlet id"},"automationName":{"type":"string"},"timezone":{"type":"string"},"kind":{"type":"string"},"status":{"type":"string"},"startedAt":{"type":"integer","description":"Unix milliseconds"},"finishedAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"startedBy":{"type":"string","enum":["schedule","app","api","hook","mcp","first"]},"hint":{"anyOf":[{"type":"object","required":["title"],"properties":{"title":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","format":"uri","maxLength":500,"description":"http or https only"},"notes":{"type":"string","maxLength":1000}},"description":"A story the run must cover. Dedupe still applies."},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"step":{"type":"string"},"at":{"type":"integer","description":"Unix milliseconds"},"note":{"type":"string"}}}},"usage":{"type":"object"},"costUsd":{"type":"number"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"shareToken":{"anyOf":[{"type":"string"},{"type":"null"}]},"stories":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"title":{"type":"string"},"url":{"type":"string"},"source":{"type":"string"},"publishedAt":{"type":"string"},"summary":{"type":"string"},"whyItMatters":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"confidence":{"type":"number"},"decision":{"type":"string","enum":["kept","skipped_dup","skipped_quality","skipped_limit","dry"]},"reason":{"type":"string"},"savedAsIdea":{"type":"boolean"}}}},"posts":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}},"Post":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"runId":{"type":"string","description":"A Dispatchlet id"},"automationId":{"type":"string","description":"A Dispatchlet id"},"storyId":{"type":"string","description":"A Dispatchlet id"},"channelId":{"type":"string"},"channelName":{"type":"string"},"service":{"type":"string"},"text":{"type":"string"},"thread":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"linkAttachment":{"anyOf":[{"type":"object"},{"type":"null"}]},"status":{"type":"string","enum":["dry","rejected","held","draft","queued","scheduled","sent","failed","deleted"]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"bufferPostId":{"anyOf":[{"type":"string"},{"type":"null"}]},"bufferStatus":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalLink":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"plannedFor":{"anyOf":[{"type":"integer","description":"With postingMode planned: the publication slot this post was planned for"},{"type":"null"}]},"sentAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"metrics":{"anyOf":[{"type":"array","items":{"type":"object"}},{"type":"null"}]},"createdAt":{"type":"integer","description":"Unix milliseconds"}}},"Webhook":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"automationId":{"anyOf":[{"type":"string","description":"A Dispatchlet id"},{"type":"null"}]},"active":{"type":"boolean"},"createdAt":{"type":"integer","description":"Unix milliseconds"},"lastDeliveryAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"lastStatus":{"anyOf":[{"type":"string","enum":["ok","failed"]},{"type":"null"}]},"failedInARow":{"type":"integer"}}},"Delivery":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"event":{"type":"string"},"attempt":{"type":"integer"},"status":{"type":"string","enum":["pending","ok","failed"]},"responseStatus":{"anyOf":[{"type":"integer"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"nextAttemptAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"createdAt":{"type":"integer","description":"Unix milliseconds"},"updatedAt":{"type":"integer","description":"Unix milliseconds"}}},"Hook":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"automationId":{"type":"string","description":"A Dispatchlet id"},"name":{"type":"string"},"prefix":{"type":"string"},"createdAt":{"type":"integer","description":"Unix milliseconds"},"lastUsedAt":{"anyOf":[{"type":"integer","description":"Unix milliseconds"},{"type":"null"}]},"uses":{"type":"integer"}}},"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthorized","forbidden","not_found","method_not_allowed","invalid","conflict","allowance","rate_limited","buffer","unavailable"]},"message":{"type":"string"},"field":{"type":"string"},"line":{"type":"integer","description":"For playbook parse errors"}}}}}}},"paths":{"/me":{"get":{"summary":"The account behind the token","security":[{"bearer":[]}],"x-scope":"read","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"A Dispatchlet id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"timezone":{"type":"string"},"allowance":{"type":"object","properties":{"ownKey":{"type":"boolean"},"runsLeft":{"anyOf":[{"type":"integer"},{"type":"null"}]},"dryRunsLeft":{"anyOf":[{"type":"integer"},{"type":"null"}]}}},"buffer":{"type":"object","properties":{"connected":{"type":"boolean"},"needsReauth":{"type":"boolean"}}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/channels":{"get":{"summary":"Your Buffer channels, with which ones Dispatchlet can post to","security":[{"bearer":[]}],"x-scope":"read","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/channels/sync":{"post":{"summary":"Read the channels from Buffer again","security":[{"bearer":[]}],"x-scope":"write","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"synced":{"type":"integer"},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations":{"get":{"summary":"List automations","security":[{"bearer":[]}],"x-scope":"read","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"automations":{"type":"array","items":{"$ref":"#/components/schemas/Automation"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create an automation from the setup answers","description":"Returns 202 with status \"generating\". The playbook is written in the background; fetch the automation again in about a minute.","security":[{"bearer":[]}],"x-scope":"write","parameters":[],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"$ref":"#/components/schemas/AutomationDetail"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["setup","channelIds"],"properties":{"setup":{"$ref":"#/components/schemas/Setup"},"channelIds":{"type":"array","items":{"type":"string"},"minItems":1}}}}}}}},"/automations/{id}":{"get":{"summary":"One automation with its playbook","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"$ref":"#/components/schemas/AutomationDetail"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Change schedule, channels, posting mode, story count or status","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"$ref":"#/components/schemas/AutomationDetail"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cadence":{"$ref":"#/components/schemas/Cadence"},"channelIds":{"type":"array","items":{"type":"string"},"minItems":1},"postingMode":{"type":"string","enum":["draft","queue","spread","planned"]},"maxPostsPerRun":{"type":"integer","minimum":1,"maximum":7,"description":"Up to 3, or one per posting day (up to 7) with postingMode planned"},"publicationPlan":{"$ref":"#/components/schemas/PublicationPlan"},"researchMode":{"type":"string","enum":["recent","archive","anniversary"],"description":"recent news (default), archive for documented history, or anniversary for on-this-day events matching each posting date. Anniversary posts are scheduled for their own date (plannedFor) in every posting mode."},"status":{"type":"string","enum":["active","paused"],"description":"active enables the schedule, paused stops it"}}}}}}},"delete":{"summary":"Delete an automation","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/automations/{id}/playbook":{"get":{"summary":"The playbook, as JSON or as text","description":"Send `Accept: text/markdown` for the text the editor shows; otherwise JSON with both.","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"createdBy":{"type":"string"},"createdAt":{"type":"integer","description":"Unix milliseconds"},"playbook":{"type":"object"},"text":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"summary":"Replace the playbook text as a new version","description":"Send the text with `Content-Type: text/markdown`, or JSON `{ \"text\" }`. A parse error comes back as 400 with the line.","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"text":{"type":"string"},"playbook":{"type":"object"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"text/markdown":{"schema":{"type":"string"}}}}}},"/automations/{id}/rules":{"post":{"summary":"Add a skip rule to the playbook","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["rule"],"properties":{"rule":{"type":"string","minLength":3,"maxLength":200}}}}}}}},"/automations/{id}/runs":{"post":{"summary":"Start a run or a dry run","description":"Returns 202 at once; poll GET /runs/{id} until finishedAt is set. 409 when a run is going, 402 when the allowance is spent.","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/Run"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"dry":{"type":"boolean","default":false},"hint":{"$ref":"#/components/schemas/Hint"}}}}}}},"get":{"summary":"Runs of an automation, newest first","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"1 to 50, default 20"},{"name":"before","in":"query","required":false,"schema":{"type":"integer"},"description":"Only runs started before this time (ms)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/RunSummary"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/runs/{id}":{"get":{"summary":"One run: steps, stories, posts, cost","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/Run"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/runs/{id}/share":{"post":{"summary":"Make a run readable by link","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/posts":{"get":{"summary":"Posts, newest first","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"draft, queued, scheduled, sent, failed, held, rejected, dry or deleted"},{"name":"automation","in":"query","required":false,"schema":{"type":"string"},"description":"Only this automation"},{"name":"since","in":"query","required":false,"schema":{"type":"integer"},"description":"Created after this time (ms)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"1 to 100, default 50"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"posts":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/posts/{id}":{"get":{"summary":"One post","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Change a draft’s text before approving it","description":"Drafts only. The text must fit the channel as the service counts it; it is saved in Buffer as a draft.","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"},"message":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}}}}}}}},"/posts/{id}/approve":{"post":{"summary":"Move a draft into the Buffer queue","description":"Calls Buffer's editPost. Already-queued posts come back unchanged.","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"},"message":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stories/{id}/idea":{"post":{"summary":"Save a story to Buffer Ideas","description":"For a story that was skipped or picked on a dry run. Calls Buffer's createIdea in the automation's organization, with the Dispatchlet tag. Saving twice returns the same idea. Needs a Buffer connection that allowed Ideas; a 403 forbidden means sign in with Buffer again.","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ideaId":{"type":"string"},"message":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"summary":"List webhooks","security":[{"bearer":[]}],"x-scope":"read","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Add a webhook","description":"The signing secret is in the response once. See /docs/webhooks for the events and the signature.","security":[{"bearer":[]}],"x-scope":"write","parameters":[],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"},"secret":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri","description":"https on port 443 or 8443, public host, no credentials"},"events":{"type":"array","items":{"type":"string","enum":["run.finished","post.created","post.approved","post.sent","automation.paused","buffer.reauth_needed","ping"]},"minItems":1},"automationId":{"type":"string","description":"Only events of this automation"}}}}}}}},"/webhooks/{id}":{"delete":{"summary":"Delete a webhook","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/test":{"post":{"summary":"Send a ping event now","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deliveryId":{"type":"string","description":"A Dispatchlet id"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/deliveries":{"get":{"summary":"The last 50 deliveries","security":[{"bearer":[]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/hooks":{"get":{"summary":"List inbound hook URLs","security":[{"bearer":[]}],"x-scope":"read","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"hooks":{"type":"array","items":{"$ref":"#/components/schemas/Hook"}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Make an inbound hook URL for an automation","description":"The URL is in the response once. POST to it to start a run; see /docs/hooks.","security":[{"bearer":[]}],"x-scope":"write","parameters":[],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","description":"A Dispatchlet id"},"prefix":{"type":"string"},"token":{"type":"string"},"url":{"type":"string"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["automationId","name"],"properties":{"automationId":{"type":"string","description":"A Dispatchlet id"},"name":{"type":"string","maxLength":40}}}}}}}},"/hooks/{hook}":{"delete":{"summary":"Delete an inbound hook","description":"`hook` is the hook’s id, as listed by GET /hooks.","security":[{"bearer":[]}],"x-scope":"write","parameters":[{"name":"hook","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Start a run from an inbound hook (no bearer token)","description":"`hook` is the hook’s token (dlh_…), which is the credential. Body: empty (run now), `{ \"title\", \"url\"?, \"notes\"?, \"dry\"? }`, or a GitHub release webhook (X-GitHub-Event: release). 10 a minute per hook.","security":[],"x-scope":"none","parameters":[{"name":"hook","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string","description":"A Dispatchlet id"},"url":{"type":"string"}}}}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","format":"uri","maxLength":500,"description":"http or https only"},"notes":{"type":"string","maxLength":1000},"dry":{"type":"boolean"}}}}}}}},"/openapi.json":{"get":{"summary":"This document","security":[],"x-scope":"none","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}