{"openapi":"3.1.0","info":{"title":"HeyMySocial API","version":"1.0.0","description":"Workspace-scoped API. Authenticate with a workspace API key; the key decides the workspace. Send an Idempotency-Key on every mutation."},"servers":[{"url":"https:\/\/heymysocial.com\/api\/v1"}],"security":[{"apiKey":[]}],"paths":{"\/ads\/import":{"post":{"operationId":"importAds","summary":"Import ad results","description":"Stores ad results for one ad account, up to 2000 rows in a request. Campaigns, ad sets and ads are created or updated by their external ids, and one set of numbers is kept for each of them and reporting period. Rows are judged one by one: good rows are stored, and a row that cannot be read comes back in errors with its index and the reason. Sending the same rows again changes nothing; a row whose dates overlap an earlier row of the same campaign, ad set or ad replaces it, so no day is counted twice. The currency is required and never guessed, and an account keeps the currency it was created with. A number you leave out is stored as missing, not as zero. This call only stores data here: nothing is sent to an ad platform.","tags":["Ads"],"security":[{"apiKey":["ads:write"]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":191},"description":"Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true instead of running the import again."}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AdsImportRequest"},"example":{"account":{"external_id":"1234567890","name":"Nordlys Solar ads","currency":"DKK","timezone":"Europe\/Copenhagen","attribution_setting":"7d_click_1d_view"},"rows":[{"campaign_external_id":"c-201","campaign_name":"Spring roof check","adset_external_id":"s-11","adset_name":"Homeowners 35-60","ad_external_id":"a-501","ad_name":"Savings image","date_start":"2026-11-23","date_stop":"2026-11-23","spend":333.33,"impressions":5500,"reach":4100,"clicks":88,"link_clicks":53,"platform_leads":7,"objective":"leads","status":"active","utm_campaign":"spring-roof"},{"campaign_external_id":"c-201","adset_external_id":"s-11","ad_external_id":"a-501","date_start":"2026-11-24","spend_minor":28750,"impressions":4720,"clicks":61,"link_clicks":40,"platform_leads":4},{"campaign_external_id":"c-201","date_start":"24\/11\/2026","spend":10}]}}}},"responses":{"200":{"description":"The import ran. Rows that could not be stored are listed in errors with their index.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AdsImportResult"},"example":{"batch_id":"01m88q4x3yn5dkax2k37nwn3q1","ad_account_id":"01m88q4x3wtwrwgn6vxet2n5zx","currency":"DKK","rows_total":3,"rows_stored":2,"rows_failed":1,"summary":{"created":2,"updated":0,"unchanged":0,"replaced":0,"skipped":0},"errors":[{"index":2,"message":"The reporting dates are missing or not dates (use 2026-11-24)."}]}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope ads:write.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: the request as a whole cannot be read. The account has no external_id or no currency, rows is missing, empty or longer than 2000, or the currency differs from the one the account is stored in. Nothing was stored.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute. Wait and send it again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/content":{"get":{"operationId":"listContent","summary":"List content items","description":"Returns the content items of the workspace the key belongs to, one page at a time. Items with a planned time come first, earliest first; items without one follow, newest first. The filters combine. Each item is the short form; get one item for its text, versions and approval.","tags":["Content"],"security":[{"apiKey":["content:read"]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["draft","review","approved","scheduled","publishing","published","failed","cancelled","delivery_uncertain"]},"description":"Only items in this status: draft, review, approved, scheduled, publishing, published, failed, cancelled or delivery_uncertain."},{"name":"channel_id","in":"query","required":false,"schema":{"type":"string","minLength":26,"maxLength":26},"description":"Only items for this channel."},{"name":"campaign_id","in":"query","required":false,"schema":{"type":"string","minLength":26,"maxLength":26},"description":"Only items in this campaign."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First day of the calendar window (YYYY-MM-DD), in the workspace time zone. Items without a planned time are left out when a window is given."},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last day of the calendar window (YYYY-MM-DD), in the workspace time zone, that day included. Not before from."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":25},"description":"Items on a page, 1 to 50. The default is 25."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"The page to return, starting at 1. A page past the end is an empty list."}],"responses":{"200":{"description":"A page of content items.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ContentItem"},"description":"The items on this page."},"meta":{"type":"object","description":"Where this page is in the whole list.","properties":{"total":{"type":"integer","description":"Number of items that match the filters, on all pages."},"page":{"type":"integer","description":"The page this is."},"per_page":{"type":"integer","description":"Items on a page."},"timezone":{"type":"string","description":"The time zone the from and to days were read in."}}}}},"example":{"data":[{"id":"01m88q4wyk57w1zfdfycbn4qf5","title":"Roof check","status":"review","platform":"mock","channel_id":"01m88q4wxrssa2ecg8rsrswg76","campaign_id":"01m88q4wxxt1xn4npmvqhz1nee","intent":"offer","format":"link","funnel_stage":"consideration","locale":"en","planned_at":"2026-12-01T08:00:00Z","planned_local":"2026-12-01T09:00","timezone":"Europe\/Copenhagen","version":2,"lock_version":2,"excerpt":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.","origin":"import","is_demo":false,"url":"https:\/\/heymysocial.com\/studio\/01m88q4wyk57w1zfdfycbn4qf5"}],"meta":{"total":1,"page":1,"per_page":25,"timezone":"Europe\/Copenhagen"}}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope content:read.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: a filter is not valid, for example an unknown status or a to day before the from day. details names the parameter.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute. Wait and send it again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"operationId":"createContentDraft","summary":"Create a draft","description":"Creates a content item in the status draft, with its first version, and answers with the result of the brand and channel checks. Only body is needed; give a channel and a planned time now or in a later version, because both are required before approval can be requested. Nothing is approved, scheduled or published by this call.","tags":["Content"],"security":[{"apiKey":["content:write"]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":191},"description":"Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true instead of doing the work twice."}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["body"],"properties":{"title":{"type":"string","maxLength":255,"description":"Title of the post, shown in the calendar and in lists. It is part of what an approval covers."},"body":{"type":"string","maxLength":10000,"description":"The post text."},"cta":{"type":"string","maxLength":255,"description":"Call to action. It goes out as the last line when the body does not already contain it."},"link_url":{"type":"string","format":"uri","maxLength":1000,"description":"The link the post points to. http or https only."},"asset_ids":{"type":"array","maxItems":10,"items":{"type":"string","minLength":26,"maxLength":26},"description":"Ids of up to 10 graphics in this workspace, in the order they should appear. An id that does not exist here is answered with 404."},"platform":{"type":"string","enum":["mock","facebook","instagram","linkedin"],"description":"Where the post is meant for when no channel is chosen yet. mock is the practice channel and the default. When channel_id is given, the channel decides and this field is ignored."},"channel_id":{"type":"string","minLength":26,"maxLength":26,"description":"Id of a channel in this workspace. An id that does not exist here is answered with 404."},"campaign_id":{"type":"string","minLength":26,"maxLength":26,"description":"Id of a campaign in this workspace. An id that does not exist here is answered with 404."},"intent":{"type":"string","enum":["educate","prove","offer","engage","announce"],"description":"What the post is for."},"format":{"type":"string","enum":["text","image","carousel","video","story","link"],"description":"The kind of post. Defaults to text. Changing it on an approved item invalidates the approval."},"funnel_stage":{"type":"string","enum":["awareness","consideration","conversion","retention"],"description":"The stage of the funnel the post speaks to."},"locale":{"type":"string","enum":["en","da"],"description":"Language of the text. Defaults to the language of the workspace."},"planned_for":{"type":["string","null"],"maxLength":20,"example":"2026-12-01 09:00","description":"Planned time as local time in the workspace time zone, written YYYY-MM-DD HH:MM. A time skipped by daylight saving is refused with details.reason dst_gap; a time that occurs twice resolves to the first. Send null to clear the time. Planning a time schedules nothing."},"note":{"type":"string","maxLength":255,"description":"What changed, shown in the version history."}}},"example":{"title":"Roof check","body":"Is your roof right for solar? A 20-minute visit answers it, and the visit is free.","cta":"Book a roof check","link_url":"https:\/\/nordlys-solar.example\/roof-check","channel_id":"01m88q4wxrssa2ecg8rsrswg76","campaign_id":"01m88q4wxxt1xn4npmvqhz1nee","intent":"offer","format":"link","funnel_stage":"consideration","locale":"en","planned_for":"2026-12-01 09:00","note":"First draft from the website team"}}}},"responses":{"201":{"description":"The draft was created. qa_issues lists what the brand and channel checks found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContentSaved"},"example":{"data":{"id":"01m88q4wyk57w1zfdfycbn4qf5","title":"Roof check","status":"draft","platform":"mock","channel_id":"01m88q4wxrssa2ecg8rsrswg76","campaign_id":"01m88q4wxxt1xn4npmvqhz1nee","intent":"offer","format":"link","funnel_stage":"consideration","locale":"en","planned_at":"2026-12-01T08:00:00Z","planned_local":"2026-12-01T09:00","timezone":"Europe\/Copenhagen","version":1,"lock_version":1,"excerpt":"Is your roof right for solar? A 20-minute visit answers it, and the visit is free.","origin":"import","is_demo":false,"url":"https:\/\/heymysocial.com\/studio\/01m88q4wyk57w1zfdfycbn4qf5","approval_lost":false},"qa_issues":[{"source":"brand","severity":"warning","code":"unverified_number","message":"This number is not in your approved facts: 20."}],"blocked_by_qa":false}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope content:write.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: the channel, the campaign or one of the graphics does not exist in this workspace.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: a field is missing or not valid (details names it), or planned_for is a time the clocks skip (details.reason is dst_gap).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute (retryable). quota_exceeded: the workspace is read-only because the plan allows fewer workspaces than the organization has.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/content\/{content}":{"get":{"operationId":"getContent","summary":"Get one content item","description":"Returns one item in full: the current text, the last ten versions, the latest approval and whether it still covers the content, the brand and channel checks, and what happened at publication. A number that was not reported is null, never 0.","tags":["Content"],"security":[{"apiKey":["content:read"]}],"parameters":[{"name":"content","in":"path","required":true,"schema":{"type":"string","minLength":26,"maxLength":26},"description":"Id of the content item (26 characters), as returned in data.id."}],"responses":{"200":{"description":"The content item.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/ContentDetail"}}},"example":{"data":{"id":"01m88q4wyk57w1zfdfycbn4qf5","title":"Roof check","status":"review","platform":"mock","channel_id":"01m88q4wxrssa2ecg8rsrswg76","campaign_id":"01m88q4wxxt1xn4npmvqhz1nee","intent":"offer","format":"link","funnel_stage":"consideration","locale":"en","planned_at":"2026-12-01T08:00:00Z","planned_local":"2026-12-01T09:00","timezone":"Europe\/Copenhagen","version":2,"lock_version":2,"excerpt":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.","origin":"import","is_demo":false,"url":"https:\/\/heymysocial.com\/studio\/01m88q4wyk57w1zfdfycbn4qf5","current":{"title":"Roof check","body":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.","cta":"Book a roof check","link_url":"https:\/\/nordlys-solar.example\/roof-check","asset_ids":[],"text_as_published":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.\n\nBook a roof check"},"versions":[{"id":"01m88q4wz4deg4ae3ryqp5jzx6","version":2,"created_by":"api","change_note":"Shorter second sentence","created_at":"2026-11-25T09:12:44+00:00","is_current":true,"is_approved":false,"body":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing."},{"id":"01m88q4wymra7ytjgf2nanyhg7","version":1,"created_by":"api","change_note":"First draft from the website team","created_at":"2026-11-25T09:12:44+00:00","is_current":false,"is_approved":false,"body":"Is your roof right for solar? A 20-minute visit answers it, and the visit is free."}],"approval":{"id":"01m88q4wzg1mthtpw3sw3t8ak6","content_id":"01m88q4wyk57w1zfdfycbn4qf5","state":"pending","requested_via":"api","requested_by":"Sofie Lund","requested_at":"2026-11-25T09:12:44+00:00","decided_by":null,"decided_at":null,"note":null,"invalidated":false,"covers_current_content":true,"usable_for_scheduling":false,"review_url":"https:\/\/heymysocial.com\/calendar?open=01m88q4wyk57w1zfdfycbn4qf5"},"qa_issues":[{"source":"brand","severity":"warning","code":"unverified_number","message":"This number is not in your approved facts: 20."}],"publication":{"scheduled_status":null,"attempts":null,"last_error":null,"published_at":null,"url":null,"recorded_by":null,"is_demo":null,"metrics":null,"metrics_read_at":null,"engagement_rate":null,"engagement_rate_denominator":null}}}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope content:read.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: no content item with this id in the workspace of the key.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute. Wait and send it again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/content\/{content}\/approval-requests":{"post":{"operationId":"requestContentApproval","summary":"Ask a person to approve","description":"Creates a pending approval request for the item exactly as it stands: this text, these graphics, this channel and this time. The item must be a draft (or already in review) with a channel and a planned time and no errors in the checks; it moves to review. The request takes no body. The person who created the API key counts as the one who asked. An earlier pending or granted approval of the item is replaced. The API cannot approve: a signed-in person does that in the app, at review_url.","tags":["Content"],"security":[{"apiKey":["content:write"]}],"parameters":[{"name":"content","in":"path","required":true,"schema":{"type":"string","minLength":26,"maxLength":26},"description":"Id of the content item (26 characters), as returned in data.id."},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":191},"description":"Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true instead of doing the work twice."}],"responses":{"202":{"description":"The request is waiting for a person.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"The request, the item and exactly what was asked for.","properties":{"approval":{"$ref":"#\/components\/schemas\/ApprovalRequest"},"content":{"$ref":"#\/components\/schemas\/ContentItem"},"requested":{"$ref":"#\/components\/schemas\/ApprovalPayload"},"review_url":{"type":"string","format":"uri","description":"The page in the app where a person with the right role approves or rejects exactly this request."}}}}},"example":{"data":{"approval":{"id":"01m88q4wzg1mthtpw3sw3t8ak6","state":"pending","requested_via":"api","requested_at":"2026-11-25T09:12:44+00:00"},"content":{"id":"01m88q4wyk57w1zfdfycbn4qf5","title":"Roof check","status":"review","platform":"mock","channel_id":"01m88q4wxrssa2ecg8rsrswg76","campaign_id":"01m88q4wxxt1xn4npmvqhz1nee","intent":"offer","format":"link","funnel_stage":"consideration","locale":"en","planned_at":"2026-12-01T08:00:00Z","planned_local":"2026-12-01T09:00","timezone":"Europe\/Copenhagen","version":2,"lock_version":2,"excerpt":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.","origin":"import","is_demo":false,"url":"https:\/\/heymysocial.com\/studio\/01m88q4wyk57w1zfdfycbn4qf5"},"requested":{"action":"publish","channel":{"id":"01m88q4wxrssa2ecg8rsrswg76","name":"Practice page","handle":"@practice","provider":"mock_social","external_id":"practice-page","account":"Practice account","is_demo":true},"format":"link","title":"Roof check","text":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.\n\nBook a roof check","link_url":"https:\/\/nordlys-solar.example\/roof-check","assets":[],"scheduled_for":{"utc":"2026-12-01T08:00:00Z","local":"2026-12-01 09:00","timezone":"Europe\/Copenhagen","offset":"+01:00"},"version":2,"version_id":"01m88q4wz4deg4ae3ryqp5jzx6"},"review_url":"https:\/\/heymysocial.com\/calendar?open=01m88q4wyk57w1zfdfycbn4qf5"}}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope content:write, or the person who created the key may no longer write drafts in this workspace.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: no content item with this id in the workspace of the key.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: the item is not ready. It has no channel or no planned time, the checks found an error (details.issues lists them), or it is neither a draft nor in review.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute. Wait and send it again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/content\/{content}\/versions":{"post":{"operationId":"addContentVersion","summary":"Add a version","description":"Saves new text as the next version of an item; fields you leave out keep their current value, and text that is identical to the current version adds no version. Changing the text, link, graphics, channel, time or format of an item that was approved, scheduled or waiting for approval invalidates that approval, takes it off the schedule and returns it to draft (approval_lost is true). An item that is publishing, published, cancelled or delivery_uncertain cannot be edited.","tags":["Content"],"security":[{"apiKey":["content:write"]}],"parameters":[{"name":"content","in":"path","required":true,"schema":{"type":"string","minLength":26,"maxLength":26},"description":"Id of the content item (26 characters), as returned in data.id."},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":191},"description":"Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true instead of doing the work twice."}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":255,"description":"Title of the post, shown in the calendar and in lists. It is part of what an approval covers."},"body":{"type":"string","maxLength":10000,"description":"The post text."},"cta":{"type":"string","maxLength":255,"description":"Call to action. It goes out as the last line when the body does not already contain it."},"link_url":{"type":"string","format":"uri","maxLength":1000,"description":"The link the post points to. http or https only."},"asset_ids":{"type":"array","maxItems":10,"items":{"type":"string","minLength":26,"maxLength":26},"description":"Ids of up to 10 graphics in this workspace, in the order they should appear. An id that does not exist here is answered with 404."},"platform":{"type":"string","enum":["mock","facebook","instagram","linkedin"],"description":"Where the post is meant for when no channel is chosen yet. mock is the practice channel and the default. When channel_id is given, the channel decides and this field is ignored."},"channel_id":{"type":"string","minLength":26,"maxLength":26,"description":"Id of a channel in this workspace. An id that does not exist here is answered with 404."},"campaign_id":{"type":"string","minLength":26,"maxLength":26,"description":"Id of a campaign in this workspace. An id that does not exist here is answered with 404."},"intent":{"type":"string","enum":["educate","prove","offer","engage","announce"],"description":"What the post is for."},"format":{"type":"string","enum":["text","image","carousel","video","story","link"],"description":"The kind of post. Defaults to text. Changing it on an approved item invalidates the approval."},"funnel_stage":{"type":"string","enum":["awareness","consideration","conversion","retention"],"description":"The stage of the funnel the post speaks to."},"locale":{"type":"string","enum":["en","da"],"description":"Language of the text. Defaults to the language of the workspace."},"planned_for":{"type":["string","null"],"maxLength":20,"example":"2026-12-01 09:00","description":"Planned time as local time in the workspace time zone, written YYYY-MM-DD HH:MM. A time skipped by daylight saving is refused with details.reason dst_gap; a time that occurs twice resolves to the first. Send null to clear the time. Planning a time schedules nothing."},"note":{"type":"string","maxLength":255,"description":"What changed, shown in the version history."},"lock_version":{"type":"integer","minimum":1,"description":"The lock_version you last read. When the item has changed since, the request is refused with version_conflict (details.current is the value now) instead of overwriting the other edit. Leave it out to save regardless."}}},"example":{"body":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.","note":"Shorter second sentence","lock_version":1}}}},"responses":{"201":{"description":"The item after the new version, with the checks run again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContentSaved"},"example":{"data":{"id":"01m88q4wyk57w1zfdfycbn4qf5","title":"Roof check","status":"draft","platform":"mock","channel_id":"01m88q4wxrssa2ecg8rsrswg76","campaign_id":"01m88q4wxxt1xn4npmvqhz1nee","intent":"offer","format":"link","funnel_stage":"consideration","locale":"en","planned_at":"2026-12-01T08:00:00Z","planned_local":"2026-12-01T09:00","timezone":"Europe\/Copenhagen","version":2,"lock_version":2,"excerpt":"Is your roof right for solar? A 20-minute visit answers it. The visit is free and you get the numbers in writing.","origin":"import","is_demo":false,"url":"https:\/\/heymysocial.com\/studio\/01m88q4wyk57w1zfdfycbn4qf5","approval_lost":false},"qa_issues":[{"source":"brand","severity":"warning","code":"unverified_number","message":"This number is not in your approved facts: 20."}],"blocked_by_qa":false}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope content:write.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: no content item with this id in the workspace of the key, or the channel, campaign or a graphic named in the body does not exist here.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"version_conflict: the item changed since the lock_version you sent; details.current is the value now. duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: a field is not valid (details names it), the item can no longer be edited, or planned_for is a time the clocks skip (details.reason is dst_gap).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute (retryable). quota_exceeded: the workspace is read-only because the plan allows fewer workspaces than the organization has.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/crm\/reconciliation-errors":{"get":{"operationId":"listCrmReconciliationErrors","summary":"List CRM reconciliation errors","description":"Returns CRM records that could not be applied and wait for a person to resolve or ignore them under Settings, Connections, for every CRM connection of the workspace. Newest first, up to limit; there are no further pages. It carries no personal data: ids, the kind of problem and a message. An error is resolved by itself when the same record is sent again and can be applied.","tags":["CRM"],"security":[{"apiKey":["leads:read"]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","resolved","ignored"],"default":"open"},"description":"Which errors to return: open (the default), resolved or ignored."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"How many to return at most, 1 to 200. The default is 50."}],"responses":{"200":{"description":"The errors with that status, newest first.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/CrmReconciliationError"},"description":"The errors, newest first."}}},"example":{"data":[{"id":"01m88q4x3qhefpa2qf4dnejr3r","connection_id":"01m88q4x0wnxgay8kd4y7w7f0k","kind":"unknown_lead","external_id":"S-89","message":"The record belongs to a lead this workspace does not know. Send the lead first, or resolve this once it has arrived.","status":"open","created_at":"2026-11-25T09:12:44+00:00","resolved_at":null}]}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope leads:read.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: status or limit is not valid. details names the parameter.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute. Wait and send it again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/crm\/{connection}\/records":{"post":{"operationId":"sendCrmRecords","summary":"Send CRM records in a batch","description":"Applies up to 500 changes from your CRM in one request: contacts, leads, opportunities and sales, each with the CRM's own id. They are the same records a signed CRM webhook carries, and they pass through the connection's status and field mapping. Records are applied one by one, in order, and each gets its own line in results. Applying a record twice changes nothing. A record that cannot be applied (it names a lead nobody knows, or is not a valid record) is kept as a reconciliation error and reported with result error; the request still answers 200. The key needs leads:write, and sales:write too when the batch holds a sale record: without it the whole batch is refused and nothing is applied.","tags":["CRM"],"security":[{"apiKey":["leads:write"]}],"parameters":[{"name":"connection","in":"path","required":true,"schema":{"type":"string","minLength":26,"maxLength":26},"description":"Id of a CRM connection in the workspace of the key. It is the last part of the address of the connection's page under Settings, Connections."},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":191},"description":"Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true instead of applying the batch again."}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","minItems":1,"maxItems":500,"items":{"$ref":"#\/components\/schemas\/CrmRecord"},"description":"The changes, oldest first. 1 to 500 in one request."}}},"example":{"records":[{"type":"lead.created","external_id":"L-1042","updated_at":"2026-11-24T10:15:00Z","data":{"name":"Mette Jensen","email":"mette@example.com","phone":"+45 55 51 23 45","company":"Jensen Byg","status":"Qualified"}},{"type":"opportunity.created","external_id":"O-311","updated_at":"2026-11-24T11:00:00Z","data":{"lead_external_id":"L-1042","name":"Roof installation","value":84000,"currency":"DKK","stage":"Quote sent"}},{"type":"sale.created","external_id":"S-88","updated_at":"2026-11-25T08:30:00Z","data":{"lead_external_id":"L-1042","opportunity_external_id":"O-311","amount":84000,"currency":"DKK","occurred_at":"2026-11-25T08:30:00Z","revenue_basis":"invoiced"}},{"type":"sale.created","external_id":"S-89","updated_at":"2026-11-25T08:31:00Z","data":{"lead_external_id":"L-9999","amount":1200,"currency":"DKK"}}]}}}},"responses":{"200":{"description":"Every record was looked at. Read results: one line for each record, in the order you sent them.","content":{"application\/json":{"schema":{"type":"object","properties":{"processed":{"type":"integer","description":"Records that were applied or needed no change."},"failed":{"type":"integer","description":"Records with the result error. Each is kept as a reconciliation error."},"results":{"type":"array","items":{"$ref":"#\/components\/schemas\/CrmRecordResult"},"description":"What happened to each record, in the order sent."}}},"example":{"processed":3,"failed":1,"results":[{"object":"lead","external_id":"L-1042","result":"created","id":"01m88q4x13nxs8p0w4ejpg4rhp"},{"object":"opportunity","external_id":"O-311","result":"created","id":"01m88q4x3a6qtyt80b8e2qk6ry"},{"object":"sale","external_id":"S-88","result":"created","id":"01m88q4x3dspgnkctw8qr2kd54"},{"object":"sale","external_id":"S-89","result":"error","detail":"unknown_lead"}]}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope leads:write, or the batch holds a sale record and the key lacks sales:write. Nothing was applied.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: no CRM connection with this id in the workspace of the key, or the connection was disconnected.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: records is missing, empty, not a list of objects, or longer than 500.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests with this key in one minute. Wait and send it again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/events":{"post":{"operationId":"ingestEvents","summary":"Send one event, or up to 100 events","description":"Records what happened to a lead: it came in, it was contacted, qualified, sold, refunded. Send one event object as the body, or an object with events for a batch. The workspace is the workspace of the key; a workspace id in the body is never read. An event seen before (the same source and event_id, or the same source, type and external_id) is answered with the status duplicate and the first result, and changes nothing, so sending again is always safe. A single event that is not valid is answered 422 and kept as a reconciliation error; in a batch it is reported as rejected in its own result and the rest is still stored. An event that names a lead nobody knows yet is stored with the warning unmatched_lead and applied when that lead arrives. Times are kept as sent. This call counts against the rate limit of the key and against the limit for event ingestion.","tags":["Events"],"security":[{"apiKey":["events:write"]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":191},"description":"Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true. Events are also recognized by their own event_id, so a retry without this header is safe as well."}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EventsRequest"},"example":{"event_id":"form-7f3a9c2e","type":"lead_created","occurred_at":"2026-11-25T09:12:44+01:00","source":"website","external_id":"web-lead-2291","campaign_ref":"spring-roof","consent_state":"granted","properties":{"contact":{"name":"Anders Holm","email":"anders@example.com","phone":"+45 55 51 98 76","company":"Holm VVS"},"form":{"message":"Call me after four","roof_type":"tile"}}}}}},"responses":{"202":{"description":"The single event was stored.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EventResult"},"example":{"status":"accepted","event_id":"01m88q4x4d3xmn1bh68e35b303","lead_id":"01m88q4x4fnc553a2pf9pk2y8s"}}}},"200":{"description":"The results of a batch, one for each event. A single event that was seen before is answered 200 too, with one result object whose status is duplicate. The example answers a batch of two: the lead above sent again, and a sale_won for it.","content":{"application\/json":{"schema":{"oneOf":[{"$ref":"#\/components\/schemas\/EventBatchResult"},{"$ref":"#\/components\/schemas\/EventResult"}],"properties":{"accepted":{"type":"integer","description":"Events that were stored."},"duplicates":{"type":"integer","description":"Events that were seen before and changed nothing."},"rejected":{"type":"integer","description":"Events that are not valid. Each is kept as a reconciliation error."},"results":{"type":"array","items":{"$ref":"#\/components\/schemas\/EventResult"},"description":"One result for each event, in the order sent."}}},"example":{"accepted":1,"duplicates":1,"rejected":0,"results":[{"status":"duplicate","event_id":"01m88q4x4d3xmn1bh68e35b303","lead_id":"01m88q4x4fnc553a2pf9pk2y8s"},{"status":"accepted","event_id":"01m88q4x59kbsehrgk3rps3a33","lead_id":"01m88q4x4fnc553a2pf9pk2y8s","sale_id":"01m88q4x5as85jrt935y653wwz"}]}}}},"401":{"description":"unauthenticated: the API key is missing, mistyped, revoked or expired.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"access_denied: the key lacks the scope events:write.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_failed: the single event is not valid (details names each field), the body is empty, or events is not a list of 1 to 100 events.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"rate_limited: too many requests in one minute, for this key or for event ingestion. Wait and send it again; the events keep their event_id, so nothing is counted twice.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"hms_live_\u2026"}},"schemas":{"Error":{"type":"object","required":["code","message","retryable"],"properties":{"code":{"type":"string","example":"validation_failed"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"object"}}},"ContentItem":{"type":"object","description":"A content item in its short form.","properties":{"id":{"type":"string","description":"Id of the content item (26 characters)."},"title":{"type":["string","null"],"description":"Title of the current version."},"status":{"type":"string","enum":["draft","review","approved","scheduled","publishing","published","failed","cancelled","delivery_uncertain"],"description":"Where the item is in its life: draft, review (waiting for a person to approve), approved, scheduled, publishing, published, failed, cancelled or delivery_uncertain."},"platform":{"type":"string","enum":["mock","facebook","instagram","linkedin"],"description":"mock (the practice channel), facebook, instagram or linkedin."},"channel_id":{"type":["string","null"],"description":"Id of the channel the post is meant for, or null when none is chosen."},"campaign_id":{"type":["string","null"],"description":"Id of the campaign the post belongs to, or null."},"intent":{"type":["string","null"],"description":"What the post is for: educate, prove, offer, engage or announce."},"format":{"type":"string","enum":["text","image","carousel","video","story","link"],"description":"The kind of post: text, image, carousel, video, story or link."},"funnel_stage":{"type":["string","null"],"description":"awareness, consideration, conversion or retention."},"locale":{"type":"string","description":"Language of the text: en or da."},"planned_at":{"type":["string","null"],"format":"date-time","description":"The planned time in UTC, or null when no time is set."},"planned_local":{"type":["string","null"],"description":"The same moment as local time in the workspace time zone, written YYYY-MM-DDTHH:MM."},"timezone":{"type":"string","description":"The time zone of the workspace (IANA name)."},"version":{"type":["integer","null"],"description":"Number of the current version, starting at 1."},"lock_version":{"type":"integer","description":"Goes up with every saved change. Send it back when you add a version, so you never overwrite an edit you have not seen."},"excerpt":{"type":"string","description":"The first 160 characters of the current text."},"origin":{"type":"string","enum":["manual","rules","mcp","import"],"description":"How the item was created: manual (a person in the app), rules (the drafting rules in the app), mcp (an assistant) or import (this API)."},"is_demo":{"type":"boolean","description":"True for invented example data in a demo workspace."},"url":{"type":"string","format":"uri","description":"The address of the item in the app, for a signed-in person."}}},"ContentSaved":{"type":"object","description":"A saved draft or version with the result of the checks.","properties":{"data":{"type":"object","description":"The content item after the save.","properties":{"id":{"type":"string","description":"Id of the content item (26 characters)."},"title":{"type":["string","null"],"description":"Title of the current version."},"status":{"type":"string","enum":["draft","review","approved","scheduled","publishing","published","failed","cancelled","delivery_uncertain"],"description":"Where the item is in its life: draft, review (waiting for a person to approve), approved, scheduled, publishing, published, failed, cancelled or delivery_uncertain."},"platform":{"type":"string","enum":["mock","facebook","instagram","linkedin"],"description":"mock (the practice channel), facebook, instagram or linkedin."},"channel_id":{"type":["string","null"],"description":"Id of the channel the post is meant for, or null when none is chosen."},"campaign_id":{"type":["string","null"],"description":"Id of the campaign the post belongs to, or null."},"intent":{"type":["string","null"],"description":"What the post is for: educate, prove, offer, engage or announce."},"format":{"type":"string","enum":["text","image","carousel","video","story","link"],"description":"The kind of post: text, image, carousel, video, story or link."},"funnel_stage":{"type":["string","null"],"description":"awareness, consideration, conversion or retention."},"locale":{"type":"string","description":"Language of the text: en or da."},"planned_at":{"type":["string","null"],"format":"date-time","description":"The planned time in UTC, or null when no time is set."},"planned_local":{"type":["string","null"],"description":"The same moment as local time in the workspace time zone, written YYYY-MM-DDTHH:MM."},"timezone":{"type":"string","description":"The time zone of the workspace (IANA name)."},"version":{"type":["integer","null"],"description":"Number of the current version, starting at 1."},"lock_version":{"type":"integer","description":"Goes up with every saved change. Send it back when you add a version, so you never overwrite an edit you have not seen."},"excerpt":{"type":"string","description":"The first 160 characters of the current text."},"origin":{"type":"string","enum":["manual","rules","mcp","import"],"description":"How the item was created: manual (a person in the app), rules (the drafting rules in the app), mcp (an assistant) or import (this API)."},"is_demo":{"type":"boolean","description":"True for invented example data in a demo workspace."},"url":{"type":"string","format":"uri","description":"The address of the item in the app, for a signed-in person."},"approval_lost":{"type":"boolean","description":"True when this save invalidated an approval the item had or was waiting for. The item is a draft again and needs a new request."}}},"qa_issues":{"type":"array","items":{"$ref":"#\/components\/schemas\/QaIssue"},"description":"What the brand and channel checks found in the saved text. Empty when nothing was found."},"blocked_by_qa":{"type":"boolean","description":"True when at least one issue is an error. Approval cannot be requested until it is fixed."}}},"ContentDetail":{"type":"object","description":"A content item in full.","properties":{"id":{"type":"string","description":"Id of the content item (26 characters)."},"title":{"type":["string","null"],"description":"Title of the current version."},"status":{"type":"string","enum":["draft","review","approved","scheduled","publishing","published","failed","cancelled","delivery_uncertain"],"description":"Where the item is in its life: draft, review (waiting for a person to approve), approved, scheduled, publishing, published, failed, cancelled or delivery_uncertain."},"platform":{"type":"string","enum":["mock","facebook","instagram","linkedin"],"description":"mock (the practice channel), facebook, instagram or linkedin."},"channel_id":{"type":["string","null"],"description":"Id of the channel the post is meant for, or null when none is chosen."},"campaign_id":{"type":["string","null"],"description":"Id of the campaign the post belongs to, or null."},"intent":{"type":["string","null"],"description":"What the post is for: educate, prove, offer, engage or announce."},"format":{"type":"string","enum":["text","image","carousel","video","story","link"],"description":"The kind of post: text, image, carousel, video, story or link."},"funnel_stage":{"type":["string","null"],"description":"awareness, consideration, conversion or retention."},"locale":{"type":"string","description":"Language of the text: en or da."},"planned_at":{"type":["string","null"],"format":"date-time","description":"The planned time in UTC, or null when no time is set."},"planned_local":{"type":["string","null"],"description":"The same moment as local time in the workspace time zone, written YYYY-MM-DDTHH:MM."},"timezone":{"type":"string","description":"The time zone of the workspace (IANA name)."},"version":{"type":["integer","null"],"description":"Number of the current version, starting at 1."},"lock_version":{"type":"integer","description":"Goes up with every saved change. Send it back when you add a version, so you never overwrite an edit you have not seen."},"excerpt":{"type":"string","description":"The first 160 characters of the current text."},"origin":{"type":"string","enum":["manual","rules","mcp","import"],"description":"How the item was created: manual (a person in the app), rules (the drafting rules in the app), mcp (an assistant) or import (this API)."},"is_demo":{"type":"boolean","description":"True for invented example data in a demo workspace."},"url":{"type":"string","format":"uri","description":"The address of the item in the app, for a signed-in person."},"current":{"$ref":"#\/components\/schemas\/ContentText"},"versions":{"type":"array","items":{"$ref":"#\/components\/schemas\/ContentVersion"},"description":"The last ten versions, newest first."},"approval":{"$ref":"#\/components\/schemas\/ContentApproval"},"qa_issues":{"type":"array","items":{"$ref":"#\/components\/schemas\/QaIssue"},"description":"What the brand and channel checks find in the current text."},"publication":{"$ref":"#\/components\/schemas\/ContentPublication"}}},"ContentText":{"type":"object","description":"The text of the current version.","properties":{"title":{"type":["string","null"],"description":"Title of the current version."},"body":{"type":"string","description":"The post text as written."},"cta":{"type":["string","null"],"description":"Call to action."},"link_url":{"type":["string","null"],"description":"The link the post points to."},"asset_ids":{"type":"array","items":{"type":"string"},"description":"Ids of the attached graphics, in order."},"text_as_published":{"type":"string","description":"The text as it goes out: the body, then the call to action on its own line when the body does not contain it."}}},"ContentVersion":{"type":"object","description":"One saved version of the text.","properties":{"id":{"type":"string","description":"Id of the version."},"version":{"type":"integer","description":"Version number, starting at 1."},"created_by":{"type":"string","enum":["user","rules","mcp","api"],"description":"What made the version: user (a person in the app), rules, mcp (an assistant) or api."},"change_note":{"type":["string","null"],"description":"The note saved with the version."},"created_at":{"type":"string","format":"date-time","description":"When the version was saved."},"is_current":{"type":"boolean","description":"True for the version the item shows now."},"is_approved":{"type":"boolean","description":"True for the version a person approved."},"body":{"type":"string","description":"The post text of this version."}}},"ContentApproval":{"type":"object","description":"The latest approval of the item. When nobody has asked yet, only state (none) and review_url (null) are present.","required":["state","review_url"],"properties":{"id":{"type":"string","description":"Id of the approval."},"content_id":{"type":"string","description":"Id of the content item it is about."},"state":{"type":"string","enum":["none","pending","approved","rejected","invalidated","expired"],"description":"none, pending, approved, rejected, invalidated (the content changed, or a newer request replaced it) or expired."},"requested_via":{"type":"string","enum":["ui","mcp","api"],"description":"Where the request came from: ui (the app), mcp (an assistant) or api."},"requested_by":{"type":["string","null"],"description":"Name of the person who asked. For a request over the API, the person who created the key."},"requested_at":{"type":"string","format":"date-time","description":"When approval was asked for."},"decided_by":{"type":["string","null"],"description":"Name of the person who approved or rejected."},"decided_at":{"type":["string","null"],"format":"date-time","description":"When the decision was made."},"note":{"type":["string","null"],"description":"The note left with the decision, or why the approval no longer counts."},"invalidated":{"type":"boolean","description":"True when the approval was thrown away."},"covers_current_content":{"type":"boolean","description":"True when the approval was asked for exactly the text, graphics, channel and time the item has now."},"usable_for_scheduling":{"type":"boolean","description":"True when a person approved and the approval still covers the current content."},"review_url":{"type":["string","null"],"format":"uri","description":"The page in the app where a person decides."}}},"ContentPublication":{"type":"object","description":"What happened when the item went out. Every field is null until there is something to report.","properties":{"scheduled_status":{"type":["string","null"],"enum":["scheduled","running","done","failed","cancelled","uncertain",null],"description":"State of the latest slot on the schedule: scheduled, running, done, failed, cancelled or uncertain."},"attempts":{"type":["integer","null"],"description":"How many times sending was tried."},"last_error":{"type":["string","null"],"description":"Why the last attempt failed or the slot was cancelled."},"published_at":{"type":["string","null"],"format":"date-time","description":"When the post went out."},"url":{"type":["string","null"],"description":"Address of the published post, when the channel gave one."},"recorded_by":{"type":["string","null"],"description":"How the post was recorded: publisher (sent from here), confirmed (a person confirmed a delivery that was uncertain), manual (a person marked it as published elsewhere) or demo."},"is_demo":{"type":["boolean","null"],"description":"True when the post went to the practice channel or is example data."},"metrics":{"type":["object","null"],"description":"The latest reading of reach, impressions, likes, comments, shares, saves and clicks. A number the channel did not report is null.","properties":{"reach":{"type":["integer","null"],"description":"People who saw the post."},"impressions":{"type":["integer","null"],"description":"Times the post was shown."},"likes":{"type":["integer","null"],"description":"Likes and other reactions."},"comments":{"type":["integer","null"],"description":"Comments."},"shares":{"type":["integer","null"],"description":"Shares."},"saves":{"type":["integer","null"],"description":"Saves."},"clicks":{"type":["integer","null"],"description":"Clicks on the post."}}},"metrics_read_at":{"type":["string","null"],"format":"date-time","description":"When the numbers were last read."},"engagement_rate":{"type":["number","null"],"description":"Likes, comments, shares and saves divided by reach, or by impressions when reach is missing; a fraction with four decimals. Null when it cannot be worked out."},"engagement_rate_denominator":{"type":["string","null"],"description":"What the rate was divided by: reach or impressions."}}},"QaIssue":{"type":"object","description":"One finding of the brand or channel checks.","properties":{"source":{"type":"string","enum":["brand","channel"],"description":"Which check found it: brand (terms, promises and claims against your approved facts) or channel (the rules of the chosen channel)."},"severity":{"type":"string","enum":["error","warning"],"description":"error blocks approval; warning does not."},"code":{"type":"string","description":"A stable name for the finding, for example unverified_number or no_channel."},"message":{"type":"string","description":"The finding in words."}}},"ApprovalRequest":{"type":"object","description":"The approval request that was created.","properties":{"id":{"type":"string","description":"Id of the approval request."},"state":{"type":"string","enum":["pending"],"description":"Always pending: only a person can decide."},"requested_via":{"type":"string","enum":["api"],"description":"Always api for a request made here."},"requested_at":{"type":"string","format":"date-time","description":"When approval was asked for."}}},"ApprovalPayload":{"type":"object","description":"Exactly what approval was asked for. The approver sees the same.","properties":{"action":{"type":"string","enum":["publish"],"description":"What would be done after approval: publish."},"channel":{"type":"object","description":"Where it would go: the id, name, handle, provider and external_id of the channel, the name of its account, and is_demo (true for the practice channel).","properties":{"id":{"type":"string","description":"Id of the channel."},"name":{"type":"string","description":"Name of the channel."},"handle":{"type":["string","null"],"description":"Its handle on the platform."},"provider":{"type":"string","description":"The kind of connection, for example mock_social for the practice channel."},"external_id":{"type":"string","description":"The id of the page or profile on the platform."},"account":{"type":["string","null"],"description":"Name of the connected account."},"is_demo":{"type":"boolean","description":"True for the practice channel."}}},"format":{"type":"string","description":"The kind of post."},"title":{"type":["string","null"],"description":"Title of the version the request covers."},"text":{"type":"string","description":"The text as it would go out, call to action included."},"link_url":{"type":["string","null"],"description":"The link of the post."},"assets":{"type":"array","description":"The attached graphics in order, each with id, name, mime (file type), format (aspect ratio) and a checksum of the file.","items":{"type":"object","properties":{"id":{"type":"string","description":"Id of the graphic."},"name":{"type":["string","null"],"description":"Its name."},"mime":{"type":["string","null"],"description":"File type."},"format":{"type":["string","null"],"description":"The aspect ratio it was made for, for example 4:5."},"checksum":{"type":["string","null"],"description":"Checksum of the file the approval covers."}}}},"scheduled_for":{"type":"object","description":"The planned time four ways: utc, local (in the workspace time zone), timezone and offset.","properties":{"utc":{"type":"string","format":"date-time","description":"The moment in UTC."},"local":{"type":"string","description":"The same moment as local time, YYYY-MM-DD HH:MM."},"timezone":{"type":"string","description":"The time zone the local time is in."},"offset":{"type":"string","description":"Its offset from UTC at that moment, for example +01:00."}}},"version":{"type":"integer","description":"Number of the version the request covers."},"version_id":{"type":"string","description":"Id of that version."}}},"CrmRecord":{"type":"object","required":["external_id"],"description":"One change in the CRM. Say what it is with type, or with object and action.","properties":{"type":{"type":"string","example":"lead.updated","description":"What changed, written object.verb: contact, lead, opportunity or sale, then created, updated, deleted or merged. lead.updated is a changed lead."},"object":{"type":"string","enum":["contact","lead","opportunity","sale"],"description":"The kind of record, when type is not given."},"action":{"type":"string","enum":["upsert","delete","merge"],"default":"upsert","description":"What to do with it, when type is not given. The default is upsert: create it or update it."},"external_id":{"type":"string","maxLength":191,"description":"The CRM's own id of the record. A whole number is accepted too."},"updated_at":{"type":"string","format":"date-time","description":"When it changed in the CRM, as ISO 8601 or Unix seconds. The default is now. For lead status the newest change wins, and a record older than what is already stored is answered stale."},"merged_into":{"type":"string","description":"For a merge: the id of the record that stays."},"data":{"$ref":"#\/components\/schemas\/CrmRecordData"}}},"CrmRecordData":{"type":"object","additionalProperties":true,"description":"The fields of the record, after the connection's field mapping. Each kind of record reads its own fields; anything else is ignored.","properties":{"name":{"type":"string","description":"Contact and lead: the name of the person. Opportunity: what the opportunity is called."},"email":{"type":"string","description":"Contact and lead: email address. A lead with the email of a contact already here is tied to that contact."},"phone":{"type":"string","description":"Contact and lead: phone number."},"company":{"type":"string","description":"Contact and lead: company."},"status":{"type":"string","description":"Lead: the status in the CRM's own words. It is translated by the connection's status mapping, then by the built-in list; a status found in neither is reported as unmapped_status and the lead keeps the status it has."},"reason":{"type":"string","description":"Lead: why it was disqualified or lost."},"contact_external_id":{"type":"string","description":"Lead: the CRM's id of the contact the lead belongs to, when contacts are sent as records of their own."},"lead_ref":{"type":"string","description":"Lead, opportunity and sale: the HeyMySocial id of the lead, when the CRM stores it. It ties the record to a lead that was captured here."},"captured_at":{"type":"string","format":"date-time","description":"Lead: when the lead came in. Used only when the record creates the lead; the default is updated_at."},"first_contacted_at":{"type":"string","format":"date-time","description":"Lead: when it was first contacted. It only fills an empty value and never replaces one recorded here."},"lead_external_id":{"type":"string","description":"Opportunity and sale: the CRM's id of the lead it belongs to. The lead must have been sent on this connection first."},"value":{"type":"number","description":"Opportunity: the estimated value in major units (84000 is 84,000.00)."},"value_minor":{"type":"integer","description":"Opportunity: the estimated value in minor units, instead of value."},"currency":{"type":"string","description":"Opportunity and sale: ISO 4217 code, three letters. A sale without one is refused as invalid_record."},"stage":{"type":"string","description":"Opportunity: the stage in the CRM's own words."},"expected_close_on":{"type":"string","format":"date","description":"Opportunity: the day it is expected to close."},"opportunity_external_id":{"type":"string","description":"Sale: the CRM's id of the opportunity it closes, when that was sent on this connection."},"amount":{"type":"number","description":"Sale: the amount in major units. A negative amount is a refund."},"amount_minor":{"type":"integer","description":"Sale: the amount in minor units, instead of amount."},"occurred_at":{"type":"string","format":"date-time","description":"Sale: when the sale happened. The default is updated_at."},"kind":{"type":"string","enum":["sale","refund"],"description":"Sale: sale or refund. The default follows the sign of the amount."},"revenue_basis":{"type":"string","enum":["booked","invoiced","collected"],"description":"Sale: what the amount stands for: booked (the default), invoiced or collected."},"note":{"type":"string","description":"Sale: a short note, kept with the sale (250 characters)."}}},"CrmRecordResult":{"type":"object","description":"What happened to one record.","properties":{"object":{"type":"string","description":"The kind of record: contact, lead, opportunity or sale. Missing when the record did not say."},"external_id":{"type":"string","description":"The CRM's id of the record."},"result":{"type":"string","enum":["created","updated","linked","unchanged","stale","echo_ignored","superseded","deleted","merged","skipped","error"],"description":"created, updated, linked (tied to a lead or contact that was already here), unchanged, stale (older than what is stored), echo_ignored (a status this product sent, coming back), superseded (a newer status here stands and is sent to the CRM), deleted, merged, skipped or error."},"id":{"type":"string","description":"The id of the record here, when there is one."},"detail":{"type":"string","description":"More about the result. For error, the kind of problem: unknown_lead, unknown_contact, invalid_record or merge_review. Otherwise a note: unmapped_status (applied, but the status has no mapping), not_linked, kept_locally, relinked, duplicate_marked or erased."}}},"CrmReconciliationError":{"type":"object","description":"A CRM record that could not be applied.","properties":{"id":{"type":"string","description":"Id of the error."},"connection_id":{"type":"string","description":"Id of the CRM connection the record came through."},"kind":{"type":"string","description":"The kind of problem: unknown_lead, unknown_contact, unmapped_status, invalid_record, deleted_in_crm, merge_review or missing_in_crm."},"external_id":{"type":["string","null"],"description":"The CRM's id of the record, when it had a usable one."},"message":{"type":"string","description":"The problem in words, and what to do about it."},"status":{"type":"string","enum":["open","resolved","ignored"],"description":"open, resolved or ignored. An ignored problem with the same record is not reported again."},"created_at":{"type":"string","format":"date-time","description":"When the problem was first seen."},"resolved_at":{"type":["string","null"],"format":"date-time","description":"When it was resolved or ignored, or null while it is open."}}},"AdsImportRequest":{"type":"object","required":["account","rows"],"description":"Results for one ad account.","properties":{"account":{"type":"object","required":["external_id","currency"],"description":"The ad account the rows belong to. It is created on the first import and found by external_id after that.","properties":{"external_id":{"type":"string","maxLength":191,"example":"1234567890","description":"Your id of the ad account. The same id is the same account."},"name":{"type":"string","maxLength":255,"description":"The name shown in the app. The default is the external_id."},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$","example":"DKK","description":"ISO 4217 code of the account, three letters. One currency for each account: use another external_id for results in another currency."},"timezone":{"type":"string","example":"Europe\/Copenhagen","description":"The time zone the account reports in (IANA name)."},"attribution_setting":{"type":"string","maxLength":64,"example":"7d_click_1d_view","description":"How the ad platform credits conversions for this account, in its own words. Kept so the numbers can be read correctly."}}},"rows":{"type":"array","minItems":1,"maxItems":2000,"items":{"$ref":"#\/components\/schemas\/AdsImportRow"},"description":"The result rows, 1 to 2000 in one request."}}},"AdsImportRow":{"type":"object","required":["date_start"],"description":"The numbers of one campaign, ad set or ad for one reporting period. The row reports the deepest thing it names: an ad, else an ad set, else a campaign, else the account as a whole. Send spend or spend_minor.","properties":{"campaign_external_id":{"type":"string","description":"The ad platform's id of the campaign. A row that names an ad set or an ad must name its campaign, by id or by name."},"campaign_name":{"type":"string","description":"Name of the campaign."},"adset_external_id":{"type":"string","description":"The ad platform's id of the ad set."},"adset_name":{"type":"string","description":"Name of the ad set."},"ad_external_id":{"type":"string","description":"The ad platform's id of the ad."},"ad_name":{"type":"string","description":"Name of the ad."},"date_start":{"type":"string","format":"date","description":"First day of the reporting period (YYYY-MM-DD)."},"date_stop":{"type":"string","format":"date","description":"Last day of the reporting period (YYYY-MM-DD). The default is date_start: one day."},"currency":{"type":"string","description":"Currency of the row. The default is the account currency, and it must equal it."},"spend":{"type":"number","example":333.33,"description":"Amount spent in major units (333.33). Not negative."},"spend_minor":{"type":"integer","example":33333,"description":"Amount spent in minor units (33333), instead of spend. When both are sent, this one is used."},"impressions":{"type":"integer","description":"Times the ad was shown."},"reach":{"type":"integer","description":"People who saw it."},"clicks":{"type":"integer","description":"All clicks."},"link_clicks":{"type":"integer","description":"Clicks on the link only. Kept apart from all clicks."},"platform_leads":{"type":"integer","description":"Leads as the ad platform reports them. Never added to the leads matched here."},"platform_conversions":{"type":"integer","description":"Conversions as the ad platform reports them."},"platform_conversion_value":{"type":"number","description":"Value of those conversions as the ad platform reports it, in major units."},"platform_conversion_value_minor":{"type":"integer","description":"The same value in minor units, instead of platform_conversion_value."},"attribution_setting":{"type":"string","description":"How the ad platform credited conversions in this row, when it differs from the account."},"objective":{"type":"string","description":"Objective of the campaign, in the words of the ad platform."},"status":{"type":"string","description":"Delivery status, in the words of the ad platform."},"utm_campaign":{"type":"string","description":"The utm_campaign the ads carry. Used to suggest which campaign here the results belong to."},"creative_title":{"type":"string","description":"Headline of the ad."},"creative_body":{"type":"string","description":"Text of the ad."},"creative_cta":{"type":"string","description":"Call to action of the ad."},"creative_link":{"type":"string","description":"The address the ad sends people to."}}},"AdsImportResult":{"type":"object","description":"What the import did.","properties":{"batch_id":{"type":"string","description":"Id of this import. It is listed with the imports on the Paid screen."},"ad_account_id":{"type":"string","description":"Id of the ad account here."},"currency":{"type":"string","description":"The currency the account is stored in."},"rows_total":{"type":"integer","description":"Rows in the request."},"rows_stored":{"type":"integer","description":"Rows that are stored now: created, updated or unchanged."},"rows_failed":{"type":"integer","description":"Rows that were not stored. Each is in errors."},"summary":{"type":"object","description":"The rows counted by what happened to them.","properties":{"created":{"type":"integer","description":"New sets of numbers."},"updated":{"type":"integer","description":"Same entity and dates as before, with new numbers."},"unchanged":{"type":"integer","description":"Already stored with the same numbers."},"replaced":{"type":"integer","description":"Earlier rows removed because a new row overlaps their dates."},"skipped":{"type":"integer","description":"Rows left out without being an error."}}},"errors":{"type":"array","description":"One entry for each row that was not stored. At most 200 are listed.","items":{"type":"object","properties":{"index":{"type":"integer","description":"Position of the row in rows, starting at 0."},"message":{"type":"string","description":"Why the row was not stored."}}}}}},"EventsRequest":{"type":"object","description":"One Event object, or a batch: an object with events.","oneOf":[{"$ref":"#\/components\/schemas\/Event"},{"type":"object","required":["events"]}],"properties":{"events":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#\/components\/schemas\/Event"},"description":"A batch of 1 to 100 events. For a single event, leave events out and send the fields of the event as the body itself, as in the example."}}},"Event":{"type":"object","required":["event_id","type","occurred_at"],"description":"One thing that happened, as the sender saw it.","properties":{"event_id":{"type":"string","maxLength":96,"description":"Your id for this event: up to 96 printable characters without spaces. The same id from the same source is the same event, so sending it again is safe."},"schema_version":{"type":"integer","enum":[1],"default":1,"description":"Version of this event format. Only 1 exists."},"type":{"type":"string","enum":["page_view","link_click","form_started","lead_created","lead_contacted","lead_qualified","lead_disqualified","appointment_booked","opportunity_created","quote_sent","sale_won","sale_lost","sale_refunded"],"description":"What happened."},"occurred_at":{"type":"string","format":"date-time","description":"When it happened, as ISO 8601 with an offset. Kept as sent; at most one day ahead of now."},"source":{"type":"string","enum":["api","crm","website"],"default":"api","description":"Which of your systems reports it. The default is api. An event is recognized as seen before only within its source."},"external_id":{"type":"string","maxLength":191,"description":"Your id of the record the event creates: the lead for lead_created, the sale for sale_won, the refund for sale_refunded. The same id is the same record."},"session_id":{"type":"string","description":"The visitor session the event belongs to: 16 to 64 letters, digits, hyphens or underscores. Send it only when the visitor consented. Visits (page_view, link_click, form_started) are kept only with a session and consent."},"lead_id":{"type":"string","description":"The HeyMySocial id of the lead the event is about (26 characters)."},"lead_external_id":{"type":"string","maxLength":191,"description":"Your id of the lead the event is about: the external_id you sent with its lead_created. Every event except lead_created and visits needs lead_id or this."},"campaign_ref":{"type":"string","maxLength":64,"description":"The reference code of the campaign, when you know it. Leave it out when you do not."},"ad_ref":{"type":"string","maxLength":191,"description":"Your reference for the ad, when you know it."},"creative_ref":{"type":"string","maxLength":191,"description":"Your reference for the creative, when you know it."},"consent_state":{"type":"string","enum":["granted","denied","unknown","not_applicable"],"default":"unknown","description":"Consent to tracking. The default is unknown. Use not_applicable when no consent question applies, such as a phone call or a record from a CRM."},"corrects_event_id":{"type":"string","maxLength":96,"description":"Marks this event as a correction of an earlier one and names its event_id: a corrected status, or a corrected sale amount."},"test":{"type":"boolean","description":"True for a test event. It is stored and shown as received, creates nothing and is not counted as usage."},"properties":{"$ref":"#\/components\/schemas\/EventProperties"}}},"EventProperties":{"type":"object","additionalProperties":true,"description":"What the event carries, by type. At most 16384 bytes as JSON. Contact details and form answers go to the lead and are never kept in the event log.","properties":{"contact":{"type":"object","description":"lead_created: who the lead is, with name, email, phone and company. At least a name, an email address or a phone number is needed.","properties":{"name":{"type":"string","maxLength":255,"description":"Name of the person."},"email":{"type":"string","format":"email","maxLength":255,"description":"Email address."},"phone":{"type":"string","maxLength":40,"description":"Phone number."},"company":{"type":"string","maxLength":255,"description":"Company."}}},"form":{"type":"object","additionalProperties":true,"description":"lead_created: the answers of the form, as up to 40 pairs of field name and value. They are shown on the lead."},"hms_ref":{"type":"string","description":"lead_created: the hms_ref value a tracked link added to the address of the landing page. It ties the lead to that click."},"tracking_link":{"type":"string","description":"lead_created: the code of the tracked link the lead came through, when there is no hms_ref."},"status":{"type":"string","enum":["contacted","qualified","disqualified","opportunity","won","lost"],"description":"lead_created: where the lead already is, for a lead that is not new. A lead stated as won becomes an opportunity with the warning won_without_sale, because a sale needs its own sale_won event."},"note":{"type":"string","description":"lead_created: a note to keep on the lead."},"contact_consent":{"type":"boolean","description":"lead_created: whether the person agreed to be contacted (the consent box of a form). Leave it out when they were not asked."},"contact_consent_source":{"type":"string","description":"lead_created: where that consent was given."},"reason":{"type":"string","description":"lead_disqualified and sale_lost: why."},"title":{"type":"string","description":"appointment_booked: what the appointment is. It becomes the next step of the lead."},"starts_at":{"type":"string","format":"date-time","description":"appointment_booked: when the appointment is. The default is occurred_at."},"name":{"type":"string","description":"opportunity_created and quote_sent: what the opportunity is called."},"estimated_value":{"type":"number","description":"opportunity_created and quote_sent: the estimated value in major units."},"estimated_value_minor":{"type":"integer","description":"The estimated value in minor units, instead of estimated_value."},"amount":{"type":"number","minimum":0,"description":"sale_won and sale_refunded: the amount in major units (84000 is 84,000.00). A sale or a refund needs amount or amount_minor."},"amount_minor":{"type":"integer","minimum":0,"description":"The amount in minor units, instead of amount."},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$","description":"ISO 4217 code of the amount or the estimated value. The default is the currency of the workspace."},"revenue_basis":{"type":"string","enum":["booked","invoiced","collected"],"description":"sale_won: what the amount stands for: booked (the default), invoiced or collected."},"verification_source":{"type":"string","enum":["manual","crm","invoice"],"description":"sale_won: how the sale was verified. The default is manual, or crm when source is crm."},"sale_external_id":{"type":"string","description":"sale_refunded: your id of the sale that is refunded. It may be left out when the lead has exactly one sale."},"sale_id":{"type":"string","description":"sale_refunded: the HeyMySocial id of the sale, instead of sale_external_id."},"click_id":{"type":"object","description":"The click id an ad platform put in the address, as an object with type and value. It is kept only when consent_state is granted, and only as a hash.","properties":{"type":{"type":"string","maxLength":16,"description":"Which click id it is, for example fbclid."},"value":{"type":"string","description":"The click id as received."}}}}},"EventResult":{"type":"object","required":["status"],"description":"What became of one event.","properties":{"status":{"type":"string","enum":["accepted","duplicate","rejected"],"description":"accepted (stored and applied), duplicate (seen before: the first result is returned and nothing changed) or rejected (not a valid event: nothing stored)."},"event_id":{"type":"string","description":"The HeyMySocial id of the stored event. It is not the event_id you sent."},"lead_id":{"type":"string","description":"Id of the lead the event created or was applied to, when there is one."},"sale_id":{"type":"string","description":"Id of the sale or refund the event recorded, when there is one."},"warning":{"type":"string","enum":["unmatched_lead","unmatched_sale","not_applied","won_without_sale"],"description":"The event was stored, but something is open: unmatched_lead (the lead is not known yet), unmatched_sale (the refund or correction names no known sale), not_applied (the lead could not take this change) or won_without_sale. All but the last are listed as reconciliation errors."},"errors":{"type":"object","description":"For rejected: what is wrong, as a list of messages for each field."},"test":{"type":"boolean","description":"True when the event was a test event. Left out otherwise."}}},"EventBatchResult":{"type":"object","required":["accepted","duplicates","rejected","results"],"description":"The results of a batch.","properties":{"accepted":{"type":"integer","description":"Events that were stored."},"duplicates":{"type":"integer","description":"Events that were seen before and changed nothing."},"rejected":{"type":"integer","description":"Events that are not valid. Each is kept as a reconciliation error."},"results":{"type":"array","items":{"$ref":"#\/components\/schemas\/EventResult"},"description":"One result for each event, in the order sent."}}}}}}