{"openapi":"3.1.0","info":{"title":"Okaytosend API","version":"1.0.0","summary":"Check a marketing email before it goes out: HOLD with evidence, or CLEAR.","description":"Docs: https://okaytosend.com/docs. Every answer is sent with Cache-Control: no-store.","contact":{"email":"support@okaytosend.com","url":"https://okaytosend.com/help"}},"servers":[{"url":"https://okaytosend.com"}],"security":[{"bearer":[]}],"paths":{"/api/v1/checks":{"post":{"operationId":"createCheck","summary":"Check an email","description":"Checks the exact email against the built-in marketing rules and the project's facts. Uses one check from the monthly allowance, except: the same email in the same project within 24 hours with unchanged sources answers with the earlier check (`reused` is present); `fresh: true` on an email checked in the last 24 hours reads the sources again for free; and a check that revises a HOLD (`revises`, or `source.platform` and `source.external_id` matching an earlier HOLD) is free at any time. Free checks run even when the allowance is used up.","security":[{"bearer":["checks:run"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckRequest"}}}},"responses":{"200":{"description":"Rare: an identical check was already running and it failed. Nothing was checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailedCheck"}}}},"201":{"description":"The check.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Check"}}}},"202":{"description":"Still checking after about 90 seconds. Read GET /api/v1/checks/{id} after the Retry-After seconds.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pending"}}}},"400":{"description":"Invalid input (the message names the field), or project_required with choices when no project was passed and the workspace has none or several.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key, or the key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"No checks left: cap_reached or plan_required. Nothing was checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown project. An ambiguous name lists choices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Use POST for this endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The body is over 2,000,000 bytes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (limit), or the free plan's 25 checks are used in the workspace's current window (free_used, with the reset time). Nothing was checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A problem on our side, or the check failed (unavailable). Nothing was checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/checks/{id}":{"get":{"operationId":"getCheck","summary":"Read a check","security":[{"bearer":["checks:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The saved verdict (the Check, without draftNote, reused or project) or the saved failure. Reading is free.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Check"},{"$ref":"#/components/schemas/FailedCheck"}]}}}},"202":{"description":"Still checking. Read again after the Retry-After seconds.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pending"}}}},"401":{"description":"Missing or invalid key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such check in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Use GET for this endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The check could not be read right now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A workspace key (ots_live_…). Scopes: checks:run, checks:read, projects:read, sources:write."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["invalid_input","project_required","unauthorized","free_used","cap_reached","plan_required","not_found","limit","unavailable"]},"message":{"type":"string","description":"What went wrong and what fixes it, in plain words. Safe to show to the person."},"date":{"type":"string","description":"free_used, cap_reached and allowance limit: when checks start again (UTC), if known.","format":"date-time"},"billingUrl":{"type":"string","description":"free_used, cap_reached and plan_required: the Billing page.","format":"uri"},"capCents":{"type":"integer","description":"cap_reached: the monthly cap on extra checks, in US cents."},"choices":{"type":"array","description":"project_required, and not_found when a project name matches more than one: each project's ID and name.","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}}}}}},"CheckRequest":{"type":"object","additionalProperties":false,"properties":{"project":{"type":"string","description":"The project's name or ID. Optional when the workspace has exactly one active project. In other workspaces leaving it out answers project_required."},"kind":{"type":"string","default":"email"},"url":{"type":"string","format":"uri"},"file":{"type":"object","required":["download_url","file_id"],"properties":{"download_url":{"type":"string","description":"HTTPS address to download the file from.","format":"uri"},"file_id":{"type":"string","description":"The file's ID in its host."},"file_name":{"type":"string"},"mime_type":{"type":"string"}}},"detail":{"type":"string","enum":["summary","full"]},"subject":{"type":"string"},"preheader":{"type":"string"},"from_name":{"type":"string"},"html":{"type":"string","description":"The email's HTML."},"text":{"type":"string","description":"The plain-text body."},"parts":{"type":"array","description":"Instead of the fields above. A part named html is read as HTML.","items":{"type":"object","required":["name","text"],"properties":{"name":{"type":"string"},"text":{"type":"string"}}}},"image_urls":{"type":"array","maxItems":8,"items":{"type":"string","format":"uri"}},"files":{"type":"array","maxItems":8,"items":{"type":"object","required":["download_url","file_id"],"properties":{"download_url":{"type":"string","description":"HTTPS address to download the file from.","format":"uri"},"file_id":{"type":"string","description":"The file's ID in its host."},"file_name":{"type":"string"},"mime_type":{"type":"string"}}}},"sources":{"type":"array","maxItems":8,"description":"Sources for this check only. Each has a title and exactly one of url, text or file.","items":{"type":"object","required":["title"],"properties":{"title":{"type":"string","maxLength":240},"url":{"type":"string","format":"uri"},"text":{"type":"string","maxLength":200000},"file":{"type":"object","required":["download_url","file_id"],"properties":{"download_url":{"type":"string","description":"HTTPS address to download the file from.","format":"uri"},"file_id":{"type":"string","description":"The file's ID in its host."},"file_name":{"type":"string"},"mime_type":{"type":"string"}}}}}},"source":{"type":"object","description":"Where the email lives.","required":["platform","external_id"],"properties":{"platform":{"type":"string","enum":["klaviyo","mailchimp","hubspot","braze","customer_io","gmail","outlook","other"]},"external_id":{"type":"string","maxLength":200},"external_url":{"type":"string","format":"uri"},"campaign_name":{"type":"string","maxLength":240}}},"revises":{"type":"string","description":"The ID of an earlier check this one follows, usually a HOLD. Re-checking a HOLD is free; revising a CLEAR check counts."},"fresh":{"type":"boolean","description":"Read the sources again instead of reusing a result from the last 24 hours. Free when the same email was checked in the last 24 hours; otherwise it counts as one check."},"title":{"type":"string"}}},"Pending":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"status":{"type":"string","const":"checking"},"estimatedWaitSeconds":{"type":"integer"},"project":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"draftNote":{"type":"string"}}},"FailedCheck":{"type":"object","required":["id","url","status","reason"],"properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"status":{"type":"string","const":"failed"},"reason":{"type":"string"}}},"Check":{"type":"object","required":["id","verdict","final","result","findingCount","findings"],"properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"verdict":{"type":"string","enum":["HOLD","CLEAR"]},"final":{"type":"boolean","description":"True only for a real test email. CLEAR with final false is CLEAR · draft."},"project":{"type":"object","description":"POST only, when project was left out: the project the answer chose.","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"draftNote":{"type":"string","description":"POST only: how to run the final check with a real test send."},"reused":{"type":"object","description":"POST only: an identical check from the last 24 hours answered. Free.","properties":{"checkedAt":{"type":"string","format":"date-time"},"minutesAgo":{"type":"integer"}}},"revises":{"type":"object","description":"The earlier check this one follows. inferred is true when the link was made from source.platform and source.external_id.","required":["id","url","verdict","kind","inferred"],"properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"verdict":{"type":"string","enum":["HOLD","CLEAR"]},"kind":{"type":"string","enum":["platform_edit","sources_changed","proposed","recheck","resent"]},"inferred":{"type":"boolean"}}},"revisionLine":{"type":"string","description":"With revises: one sentence on what changed."},"followUps":{"type":"array","description":"On a HOLD checked again later: each later check.","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"verdict":{"type":"string","enum":["HOLD","CLEAR"]},"kind":{"type":"string","enum":["platform_edit","sources_changed","proposed","recheck","resent"]},"at":{"type":"string","format":"date-time"}}}},"findingCount":{"type":"integer","minimum":0,"description":"How many problems hold the email. 0 on CLEAR."},"findings":{"type":"array","description":"Every problem, most serious first.","items":{"$ref":"#/components/schemas/Finding"}},"nextSteps":{"type":"array","description":"On a HOLD: the choices the person has.","items":{"type":"string"}},"source":{"type":"object","description":"Where the email lives, as passed.","properties":{"platform":{"type":"string"},"external_id":{"type":"string"},"external_url":{"type":"string","format":"uri"},"campaign_name":{"type":"string"}}},"provenanceLine":{"type":"string","description":"With source: one sentence naming where the email lives."},"images":{"type":"array","description":"The images that were read.","items":{"type":"object","properties":{"ref":{"type":"string"},"url":{"type":"string"},"originalUrl":{"type":"string"}}}},"unsubscribe":{"$ref":"#/components/schemas/UnsubscribeAssessment"},"result":{"$ref":"#/components/schemas/Result"}}},"Finding":{"type":"object","properties":{"title":{"type":"string"},"rule":{"type":"string"},"state":{"type":"string"},"level":{"type":"integer"},"emailQuote":{"type":"string"},"source":{"type":["object","null"],"properties":{"title":{"type":"string"},"quote":{"type":"string"},"url":{"type":["string","null"]},"location":{"type":["string","null"]},"readAt":{"type":["string","null"],"format":"date-time"}}}}},"UnsubscribeAssessment":{"type":"object","required":["listSend","found"],"properties":{"listSend":{"type":"boolean","description":"The project or source platform identifies a mailing-list send."},"found":{"enum":["link","platform_tag","list_unsubscribe_header","visible_option",null]},"note":{"type":"string","description":"Advisory only. It does not hold the email."}}},"Result":{"type":"object","properties":{"contractVersion":{"type":"integer"},"content":{"type":"object","properties":{"kind":{"type":"string"},"parts":{"type":"array","items":{"type":"string"}}}},"unsubscribe":{"$ref":"#/components/schemas/UnsubscribeAssessment"},"claims":{"type":"array","items":{"$ref":"#/components/schemas/Claim"}},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"limits":{"type":"array","items":{"type":"object"}},"checkedAgainst":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"readAt":{"type":"string","format":"date-time"},"origin":{"type":"string","enum":["standing","supplied"]}}}},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"usage":{"type":"object","properties":{"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"costUsd":{"type":"number"},"ms":{"type":"integer"}}}}},"Claim":{"type":"object","required":["id","status","quote"],"properties":{"id":{"type":"string"},"problemId":{"type":"string","description":"Shared by the claims that mark the same finding in multiple email parts."},"status":{"type":"string","enum":["VERIFIED","CONTRADICTED","UNVERIFIED","CONFLICTING","N/A"]},"code":{"type":"string","enum":["SOURCE_MATCH","VALUE_MISMATCH","WRONG_WEEKDAY","PAST_DEADLINE","PLACEHOLDER_LEFT","DEAD_LINK","BROKEN_IMAGE","SUBJECT_BODY_MISMATCH","OFFER_NO_END","DISCOUNT_MATH","NO_UNSUBSCRIBE","SOURCE_CONFLICT","NO_SOURCE","NEEDS_REVIEW","SUBJECTIVE","SOURCE_UNREADABLE","SIGN_IN_REQUIRED"]},"kind":{"type":"string"},"quote":{"type":"string","description":"Exactly what the email says."},"part":{"type":"string"},"expected":{"type":"string","description":"The right value, when it is known."},"reason":{"type":"string","description":"Why the available evidence could not decide the claim."},"evidence":{"type":"array","items":{"type":"object","properties":{"sourceId":{"type":"string"},"factId":{"type":"string"},"location":{"type":"string"},"title":{"type":"string"},"quote":{"type":"string"},"value":{"type":"string"},"url":{"type":"string"},"readAt":{"type":"string","format":"date-time"},"origin":{"type":"string","enum":["standing","supplied"]},"role":{"type":"string","enum":["supports","contradicts","conflicts","unreviewed"]}}}}}}}}}