{"openapi":"3.1.0","info":{"title":"Twain Public API","description":"API keys are available for all registered users at [twain.ai](https://twain.ai).<br>\nThe API key should be provided as the value for the header with name `X-Api-Key`.\n\nThe endpoints that consume credits are:\n- _Generate Sequence_ and _Generate Contact Async_: priced by the request's `mode` — `BASE` costs 1 credit, `HIGH` costs 2 credits, `ULTRA` costs 8 credits plus 2 per sequence step. Requests that provide no `mode` run at `HIGH`'s depth and cost 2 credits. The asynchronous endpoint is charged when it accepts the request, and refunded if the generation later fails.\n- _Add Contact To Automation_: priced by the generation mode the workflow runs at (`BASE` 1 credit, `HIGH` 2 credits, `ULTRA` 8 credits plus 2 per sequence step).\n- _Add Contacts To Flow_ and _Add Accounts To Flow_: adding is free; each run charges for the flow's steps as they run, as runs started in Twain do.\n\nAll other endpoints have no cost.\n\nThe rate limits are:\n- _Add Contact To Automation_: 500 requests/minute\n- _All other endpoints_: 100 requests/minute\n\nResponse headers indicate remaining rate limit and reset time:\n- `x-ratelimit-limit`\n- `x-ratelimit-remaining`\n- `x-ratelimit-reset`\n\n> Note on naming: Earlier versions of the API used `Recipient`/`Lead` for the person being reached out to. The API has converged on `Contact`. Legacy endpoints (`/Generate/Lead`, `/Generate/Lead/Async`, `/Workflow/AddRecipient`) and legacy request fields (`recipient`, `add_lead_to_campaign`) continue to work and behave identically to their `Contact` counterparts, so any integration built against the old names keeps functioning unchanged.\n>\n> A workflow is what Twain's UI calls a campaign's _Automation_. The API keeps the workflow names, so a `workflow_id` is the Automation ID shown in the app.","version":"1.0.0"},"paths":{"/Credits":{"get":{"tags":["Account"],"summary":"Get Credits","description":"Get the amount of currently available credits for the account/team.\n\nThe amount of credits will be the same that is shown in Twain's UI where:\n- If the account is part of a team, it the returned will amount will be the amount of credits available\non the shared team subscription.\n- Otherwise, it will return the account's personal credit balance.","operationId":"get_credits_Credits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCreditsResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/Workspaces":{"get":{"tags":["Account"],"summary":"Get Workspaces ","description":"Get the workspaces accessible to the account/team associated with an API key.","operationId":"get_workspaces__Workspaces_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"workspace_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["team","private"],"type":"string"},{"type":"null"}],"description":"Filter by workspace type: 'team' for shared/team workspaces, 'private' for personal workspaces.","title":"Workspace Type"},"description":"Filter by workspace type: 'team' for shared/team workspaces, 'private' for personal workspaces."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetWorkspacesResponse"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}},"description":"Too Many Requests"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/Agents":{"get":{"tags":["Account"],"summary":"Get Agents ","description":"Get the agents accessible to the account/team associated with an API key.","operationId":"get_agents__Agents_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of agents to return, ordered by most recently updated.","default":1000,"title":"Limit"},"description":"Maximum number of agents to return, ordered by most recently updated."},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional workspace ID to filter agents to a specific workspace.","title":"Workspace Id"},"description":"Optional workspace ID to filter agents to a specific workspace."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAgentsResponse"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}},"description":"Too Many Requests"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/Campaigns":{"get":{"tags":["Campaigns"],"summary":"Get Campaigns ","description":"Get the latest updated campaigns associated with an API key/team.","operationId":"get_campaigns__Campaigns_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of campaigns to return.","default":1000,"title":"Limit"},"description":"Maximum number of campaigns to return."},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter campaigns to a specific workspace.","title":"Workspace Id"},"description":"Filter campaigns to a specific workspace."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCampaignsResponse"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}},"description":"Too Many Requests"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/Campaigns/{campaign_id}":{"get":{"tags":["Campaigns"],"summary":"Get Campaign","description":"Get a single campaign's name, sequence length, and per-mode generation price.\n\nAccepts either kind of campaign ID. An authorized `twn_<campaign_id>_<secret>` ID\nworks from any API key, since the secret is itself the grant. A plain campaign ID\nonly works from an API key whose account or team owns the campaign.\n\nUse `generation_costs` to price a generation before making one: it reports what each\n`mode` costs for *this* campaign, which is what the deeper modes need — their price\nscales with the number of messages in the campaign's sequence.\n\nThis endpoint reports on the campaign without changing it. A campaign whose sequence\nhas not been set up yet is described by its brief instead, and gets its sequence\ncreated on its first generation. If the campaign has no brief stating a length\neither, `message_count` is `null` and the modes priced per step report no `credits` —\ntheir price depends on a sequence that does not exist yet.\n\n_This endpoint has no cost. Rate limit is 100 requests/minute._","operationId":"get_campaign_Campaigns__campaign_id__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","description":"The campaign to describe. Accepts either form of ID: the campaign's public ID, or an authorized `twn_...` ID.","examples":["<your-campaign-id>"],"title":"Campaign Id"},"description":"The campaign to describe. Accepts either form of ID: the campaign's public ID, or an authorized `twn_...` ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetails"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}},"description":"Too Many Requests"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/Campaigns/{campaign_id}/Jobs/{job_id}":{"get":{"tags":["Campaigns"],"summary":"Get Campaign Job","description":"Get the state of a job started with `/Generate/Contact/Async`, to poll for its result instead of waiting for the callback.\n\n`status` is `processing` until generation finishes. After that, the body is the payload the\ncallback receives: `completed` with the `result`, or `failed` with the `error`. The job stays\nreadable after its callback is delivered, and also when delivery fails.\n\nOnly the account that started the job can read it. Any other caller gets `404`.\n\n_This endpoint has no cost. Rate limit is 100 requests/minute._","operationId":"get_campaign_job_Campaigns__campaign_id__Jobs__job_id__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","description":"The `campaign_id` the job was started with. Accepts either form of ID: the campaign's public ID, or an authorized `twn_...` ID.","examples":["<your-campaign-id>"],"title":"Campaign Id"},"description":"The `campaign_id` the job was started with. Accepts either form of ID: the campaign's public ID, or an authorized `twn_...` ID."},{"name":"job_id","in":"path","required":true,"schema":{"type":"string","description":"The `job_id` returned by `/Generate/Contact/Async`.","title":"Job Id"},"description":"The `job_id` returned by `/Generate/Contact/Async`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateContactAsyncJobResponse"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}},"description":"Too Many Requests"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/Workflows":{"get":{"tags":["Workflows"],"summary":"Get Automations","description":"Get the latest updated workflows associated with an API key/team.\n\nEach workflow is a campaign's Automation in Twain's UI and is listed with\nthat campaign's `campaign_id`. Workflows whose campaign was deleted, or\nwhose steps were all removed, are left out.","operationId":"get_workflows__Workflows_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of workflows to return.","default":1000,"title":"Limit"},"description":"Maximum number of workflows to return."},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter workflows to a specific workspace.","title":"Workspace Id"},"description":"Filter workflows to a specific workspace."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetWorkflowsResponse"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}},"description":"Unauthorized"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}},"description":"Too Many Requests"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/Generate/Sequence":{"post":{"tags":["Campaigns"],"summary":"Generate Sequence","description":"Research the provided Contact and generate a sequence based on a campaign configured through Twain's website.\n\n_Must provide a Contact with at least one of `linkedin_profile_url`, `work_email` or `website` to ensure we can research the contact/company._\n\nThe response will include an excerpt of some of Twain's research on the Contact, as well as a personalized sequence.<br>\nA personalized subject line is present in the response if the sequences that contain at least 1 email step\n\nSet `mode` to choose how much research and reasoning to spend on the Contact. The deeper\nmodes also return analysis: `HIGH` adds a `thesis` for the Contact, and `ULTRA` adds both\na `thesis` and a `strategy`.\n\n`ULTRA` is accepted here but not recommended: its research and per-step reasoning routinely\nrun for minutes, which is longer than most HTTP clients wait for a response. Prefer\n`/Generate/Contact/Async`, which returns immediately and delivers the result to a callback.\n\nThis endpoint dynamically fetches the configuration of the sequence associated with the\n`campaign_id` (cached for 45s) from the associated Twain account and will use it to generate\nthe messages based on the setup.\n\nThe `campaign_id` is retrieved by pressing the \"...\" menu on the Campaign and selecting \"Copy ID\".\n\nField naming: The Contact is sent in the `contact` field of the request body. The legacy field\nname `recipient` is still accepted as input for backwards compatibility.\n\n_Requests are priced by `mode`. Rate limit is 100 requests/minute._","operationId":"generate_sequence_Generate_Sequence_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateSequenceSyncRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateSequenceSyncResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapacityExhaustedResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/Generate/Contact/Async":{"post":{"tags":["Campaigns"],"summary":"Generate Contact Async","description":"Research a Contact and generate a personalized sequence for them, asynchronously.\n\nAccepts the request, validates the campaign, and queues the job for async processing.\nReturns immediately with a `job_id` and `status: \"accepted\"`.\n\nWhen generation completes, the result is POSTed to `callback_url`, if you provide one. You can\nalso read the result with `GET /Campaigns/{campaign_id}/Jobs/{job_id}`, with or without a\ncallback.\n\nGeneration typically completes within minutes. If the result cannot be generated within\n6 hours (only under extreme load), the job fails and any consumed credits are refunded.\n\nSet `mode` to choose how much research and reasoning to spend on the Contact: `BASE` costs 1 credit, `HIGH` costs 2 credits, `ULTRA` costs 8 credits plus 2 per sequence step. Requests that provide no `mode` run at `HIGH`'s depth and cost 2 credits.\nThe deeper modes also return analysis: `HIGH` adds a `thesis` for the Contact, and `ULTRA`\nadds both a `thesis` and a `strategy`.\n\nField naming: The Contact is sent in the `contact` field of the request body. The legacy field\nname `recipient` is still accepted as input for backwards compatibility.\n\n_Rate limit is 100 requests/minute._","operationId":"generate_contact_async_Generate_Contact_Async_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateContactAsyncRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateContactAsyncAcceptedResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"callbacks":{"contact_async_callback":{"{$callback_url}":{"post":{"summary":"Contact Async Callback","description":"The callback will be POSTed when generation completes or fails.\n\nDelivery is attempted up to 3 times with exponential backoff. Respond with\n`410 Gone` to retire an endpoint — we stop retrying that delivery\nimmediately instead of using the remaining attempts.","operationId":"contact_async_callback__callback_url__post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateContactCallbackPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}},"security":[{"APIKeyHeader":[]}]}},"/Workflow/AddContact":{"post":{"tags":["Workflows"],"summary":"Add Contact To Automation","description":"Add a Contact to a campaign's Automation for processing.\n\n_Must provide a Contact with at least one of `linkedin_profile_url`, `work_email` or `website` to ensure we can research the contact/company._\n\nThe Contact will be researched and processed according to the workflow configuration.\nProcessing happens asynchronously — this endpoint returns immediately once the Contact has been queued.\n\nIf the Contact already exists as an active lead in the workflow's campaign (matched by\n`work_email` or `linkedin_profile_url`), it is ignored: nothing is re-generated, **no credits\nare charged**, and the workflow job completes referencing the existing lead.\n\nThe `workflow_id` is the campaign's Automation ID in Twain. To copy it, open the campaign's menu in the campaign list and choose _Copy ID_ → _Automation ID_, or press _Copy Automation ID_ in the Automation's Clay import step. `GET /Workflows` also lists every workflow with its `campaign_id`.<br>\nThe campaign's URL holds the campaign ID, not the Automation ID.\n\nField naming: The Contact is sent in the `contact` field of the request body. The legacy field\nname `recipient` is still accepted as input for backwards compatibility.\n\n_Requests are priced by the generation mode the workflow runs at (`BASE` 1 credit, `HIGH` 2 credits, `ULTRA` 8 credits plus 2 per sequence step). Rate limit is 500 requests/minute._","operationId":"add_contact_to_workflow_Workflow_AddContact_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddContactToWorkflowRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowQueueUnavailableResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/Flow/AddContacts":{"post":{"tags":["Flows"],"summary":"Add Contacts To Flow","description":"Add contacts to a flow in Twain Flow. Each one starts a run through the flow's steps, which goes on in Twain after this request returns. While the flow is off or paused, its runs wait without taking a step (`held`) until it is turned on or resumed, except those a preview of the flow takes in.\n\nThey arrive at the flow's source for contacts sent from outside Twain, which the flow's chat sets up. Values in `fields` fill the data points that source reads them into; ask the flow's chat which names it reads. `ignored_fields` lists the names whose values the flow did not read as sent.\n\nA contact the flow already has runs again only when its source lets it, and one sent again with the same `event_id` never does: `skipped` counts them. Send an `event_id` when you may send the same contacts again, such as after a timeout: without one, they run again whenever the source lets them.\n\n_Adding is free. Each run charges for the flow's steps as they run, as runs started in Twain do. Rate limit is 100 requests/minute._","operationId":"add_contacts_to_flow_Flow_AddContacts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddContactsToFlowRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddToFlowResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}}},"400":{"description":"The flow cannot take what was sent."},"404":{"description":"No flow with this ID that you can use."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/Flow/AddAccounts":{"post":{"tags":["Flows"],"summary":"Add Accounts To Flow","description":"Add accounts to a flow in Twain Flow. Each one starts a run through the flow's steps, which goes on in Twain after this request returns. While the flow is off or paused, its runs wait without taking a step (`held`) until it is turned on or resumed, except those a preview of the flow takes in.\n\nThey arrive at the flow's source for accounts sent from outside Twain, which the flow's chat sets up. Values in `fields` fill the data points that source reads them into; ask the flow's chat which names it reads. `ignored_fields` lists the names whose values the flow did not read as sent.\n\nA account the flow already has runs again only when its source lets it, and one sent again with the same `event_id` never does: `skipped` counts them. Send an `event_id` when you may send the same accounts again, such as after a timeout: without one, they run again whenever the source lets them.\n\n_Adding is free. Each run charges for the flow's steps as they run, as runs started in Twain do. Rate limit is 100 requests/minute._","operationId":"add_accounts_to_flow_Flow_AddAccounts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddAccountsToFlowRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddToFlowResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitResponse"}}}},"400":{"description":"The flow cannot take what was sent."},"404":{"description":"No flow with this ID that you can use."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}}},"components":{"schemas":{"AddAccountsToFlowRequest":{"properties":{"flow_id":{"type":"string","maxLength":200,"minLength":1,"title":"Flow Id","description":"The flow's ID, the last part of its URL in Twain Flow.","examples":["<your-flow-id>"]},"source_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Source Id","description":"Which of the flow's sources they arrive at, needed only when the flow has more than one that takes them from outside Twain."},"event_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Event Id","description":"Your ID for what you are sending, such as the sign-up's ID. Sent again with the same `event_id`, an entry starts no second run, so a request you retry is safe. Without one, entries sent again run again whenever the flow's source lets them."},"accounts":{"items":{"$ref":"#/components/schemas/FlowAccount"},"type":"array","maxItems":100,"minItems":1,"title":"Accounts","description":"The accounts to add, at most 100 per request."}},"additionalProperties":false,"type":"object","required":["flow_id","accounts"],"title":"AddAccountsToFlowRequest"},"AddContactToWorkflowRequest":{"properties":{"workflow_id":{"type":"string","maxLength":200,"minLength":1,"title":"Workflow Id","description":"The ID of the workflow to add the contact to: the Automation ID in Twain's UI.","examples":["<your-workflow-id>"]},"contact":{"$ref":"#/components/schemas/ValidatedContact","description":"Information about the contact to add to the workflow. The legacy field name `recipient` is still accepted as input for backwards compatibility.","examples":[{"custom_variables":[],"linkedin_profile_url":"https://linkedin.com/in/mohamed-chahin-founder-twain","work_email":"mc@usetwain.com"}]}},"additionalProperties":false,"type":"object","required":["workflow_id","contact"],"title":"AddContactToWorkflowRequest"},"AddContactsToFlowRequest":{"properties":{"flow_id":{"type":"string","maxLength":200,"minLength":1,"title":"Flow Id","description":"The flow's ID, the last part of its URL in Twain Flow.","examples":["<your-flow-id>"]},"source_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Source Id","description":"Which of the flow's sources they arrive at, needed only when the flow has more than one that takes them from outside Twain."},"event_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Event Id","description":"Your ID for what you are sending, such as the sign-up's ID. Sent again with the same `event_id`, an entry starts no second run, so a request you retry is safe. Without one, entries sent again run again whenever the flow's source lets them."},"contacts":{"items":{"$ref":"#/components/schemas/FlowContact"},"type":"array","maxItems":100,"minItems":1,"title":"Contacts","description":"The contacts to add, at most 100 per request."}},"additionalProperties":false,"type":"object","required":["flow_id","contacts"],"title":"AddContactsToFlowRequest"},"AddToFlowResponse":{"properties":{"flow_id":{"type":"string","title":"Flow Id","description":"The flow they were added to."},"started":{"type":"integer","title":"Started","description":"How many started a run in the flow, which goes on in Twain unless it is `held`."},"held":{"type":"integer","title":"Held","description":"Of `started`, how many wait without taking a step, such as while the flow is off or paused. They go on once it is turned on or resumed."},"skipped":{"type":"integer","title":"Skipped","description":"How many did not: the flow already has them and does not run them again, or they were sent before with the same `event_id`."},"ignored_fields":{"items":{"type":"string"},"type":"array","title":"Ignored Fields","description":"The names in `fields` whose values the flow did not read as sent: its source reads no data point from the name, or a value does not fit the data point's type, such as text for a number or a choice it does not offer. Correct the names or values you send, or ask the flow's chat to read the name.","examples":[[]]}},"type":"object","required":["flow_id","started","held","skipped","ignored_fields"],"title":"AddToFlowResponse"},"Agent":{"properties":{"agent_id":{"type":"string","title":"Agent Id","description":"The ID of the agent."},"name":{"type":"string","title":"Name","description":"The name of the agent as seen in Twain's UI"},"url":{"type":"string","title":"Url","description":"A direct link to the agent in Twain's UI"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The agent description, providing context about what the agent is for."}},"type":"object","required":["agent_id","name","url"],"title":"Agent"},"ApiConversationMessage":{"properties":{"body":{"type":"string","maxLength":5000,"title":"Body","description":"The message text.","examples":["Thanks for connecting! Not the right time — maybe next quarter."]},"direction":{"anyOf":[{"type":"string","enum":["incoming","outgoing"]},{"type":"null"}],"title":"Direction","description":"Who sent the message: 'outgoing' = from you/your team, 'incoming' = from the contact. For HeyReach, map sender ME → 'outgoing' and CORRESPONDENT → 'incoming'."},"sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent At","description":"When the message was sent (ISO 8601 string), used to convey recency."}},"additionalProperties":false,"type":"object","required":["body"],"title":"ApiConversationMessage","description":"A single message in a prior conversation thread supplied via the API.\n\nUsed to give generation context about an existing relationship (e.g. a\nLinkedIn/HeyReach thread) so the outreach continues the conversation\ninstead of cold-opening."},"Campaign":{"properties":{"campaign_id":{"type":"string","title":"Campaign Id","description":"The ID of the campaign. This is a private ID for the campaign, that allows usage of the campaign in the API from any API key, even if the API key is associated with an account that does not have access to it in Twain."},"public_campaign_id":{"type":"string","title":"Public Campaign Id","description":"The public (non-secret) ID for the campaign, that is also shown part of the URL on Twain's website. This can be used as identifier for a campaign in the public API, but it will only work from API keys that already have access to the campaign."},"name":{"type":"string","title":"Name","description":"The name of the campaign as seen in Twain's UI"},"url":{"type":"string","title":"Url","description":"A direct link to the campaign in Twain's UI"},"campaign_idea":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Idea","description":"The campaign idea / reason for reaching out, providing context about what the campaign is about."}},"type":"object","required":["campaign_id","public_campaign_id","name","url"],"title":"Campaign"},"CampaignDetails":{"properties":{"campaign_id":{"type":"string","title":"Campaign Id","description":"The ID of the campaign. This is a private ID for the campaign, that allows usage of the campaign in the API from any API key, even if the API key is associated with an account that does not have access to it in Twain."},"public_campaign_id":{"type":"string","title":"Public Campaign Id","description":"The public (non-secret) ID for the campaign, that is also shown part of the URL on Twain's website. This can be used as identifier for a campaign in the public API, but it will only work from API keys that already have access to the campaign."},"name":{"type":"string","title":"Name","description":"The name of the campaign as seen in Twain's UI"},"url":{"type":"string","title":"Url","description":"A direct link to the campaign in Twain's UI"},"message_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Message Count","description":"The number of messages a generation for this campaign produces: the length of its sequence once it has one, and before that the length its brief states, which sequence creation follows. `null` when the campaign has neither — its length is then decided when the sequence is first created, and cannot be known in advance.","examples":[3]},"generation_costs":{"additionalProperties":{"anyOf":[{"type":"number"},{"type":"null"}]},"propertyNames":{"$ref":"#/components/schemas/PublicGenerationMode"},"type":"object","title":"Generation Costs","description":"What one generation for this campaign costs at each `mode`, keyed by mode and priced at this campaign's own `message_count` so the per-step modes report an amount rather than a formula. Every mode is always present as a key. A price is `null` only when that mode is priced per sequence step and `message_count` is not yet determined — the price then depends on a sequence that does not exist yet, and the flat-priced modes are unaffected. Key order carries no meaning; sort by value to rank modes by price.","examples":[{"BASE":1,"HIGH":2,"ULTRA":14}]}},"type":"object","required":["campaign_id","public_campaign_id","name","url","message_count","generation_costs"],"title":"CampaignDetails"},"CapacityExhaustedResponse":{"properties":{"message":{"type":"string","title":"Message"},"code":{"type":"string","const":"capacity_exhausted","title":"Code","examples":["capacity_exhausted"]}},"additionalProperties":false,"type":"object","required":["message","code"],"title":"CapacityExhaustedResponse","description":"503: Twain's research capacity is temporarily exhausted.\n\nNothing was charged for the request. The response carries a ``Retry-After``\nheader naming the delay (in seconds) after which a retry is expected to\nsucceed. Distinct from 429, which means this account sent too many\nconcurrent requests — a 503 is Twain's own upstream capacity, not the\ncaller's usage."},"Company":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the company.","examples":["Twain"]},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website","description":"The website associated with the company.","examples":["https://www.twain.ai"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"A description of the company based on Twain's research.","examples":["Twain provides an AI copywriting tool designed for outbound sales communication at scale. It assists users in generating personalized outreach messages by leveraging deep research and social proof. The platform aims to improve the quality and relevance of sales communication for various business needs."]},"size":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Size","description":"An estimation of the size of the company as a range.","examples":["1-10"]}},"additionalProperties":false,"type":"object","title":"Company"},"ContactPersona":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the Persona chosen and used for the Contact's generation.","examples":["CEO"]}},"additionalProperties":false,"type":"object","title":"ContactPersona","description":"The name of persona used for generation for the contact. Chosen among the available on the campaign."},"ContactWarningCategory":{"type":"string","enum":["BAD_LINKEDIN_URL","NO_ACTIVE_EMPLOYMENT","NO_LONGER_AT_COMPANY","INCOMPLETE_PROFILE","PERSONA_MISMATCH","COMPANY_MISMATCH","GEOGRAPHY_MISMATCH","EMAIL_NAME_MISMATCH","OUTDATED_INSIGHTS","MESSAGE_ISSUE","CAMPAIGN_DEVIATION","OTHER"],"title":"ContactWarningCategory","description":"Categories of warnings that can be present on a contact."},"ContactWarnings":{"properties":{"has_warnings":{"type":"boolean","title":"Has Warnings","description":"Boolean indicating whether any warnings were present on the contact."},"categories":{"items":{"$ref":"#/components/schemas/ContactWarningCategory"},"type":"array","title":"Categories","description":"The distinct warning categories present on the contact. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"A summary of the warnings present if if any. `null` when no warnings. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI.","examples":["Contact is not aligned with the campaigns persona."]}},"additionalProperties":false,"type":"object","required":["has_warnings"],"title":"ContactWarnings","description":"Possible warnings on contact not being a match for the campaign."},"ConversationAttachment":{"properties":{"kind":{"type":"string","enum":["image","video","file","voice","post"],"title":"Kind"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"mime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mime Type"},"size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Size"},"duration_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Ms"},"transcript":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcript"}},"type":"object","required":["kind"],"title":"ConversationAttachment","description":"Something a conversation message carried beside its words, as the sequencer reports it."},"CustomVariable":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"}},"type":"object","title":"CustomVariable"},"ExpandedResearch":{"properties":{"about":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"About the contact professionally"},"insights":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"Key insights about person/company"},"talking_points":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"Conversation topics with examples"},"discovery_questions":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"Questions for discovery"},"why_now":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"Why reach out now"},"why_us":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"Why your solution fits"},"call":{"anyOf":[{"$ref":"#/components/schemas/ResearchSection"},{"type":"null"}],"description":"Cold call opener"}},"type":"object","title":"ExpandedResearch","description":"Expanded research generated by Twain"},"FlowAccount":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"The company's name.","examples":["Acme"]},"domain":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Domain","description":"The company's website or domain.","examples":["acme.com"]},"linkedin_url":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Linkedin Url","description":"The company's LinkedIn page.","examples":["https://www.linkedin.com/company/acme"]},"fields":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string","maxLength":3000},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"type":"object"},{"type":"null"}],"title":"Fields","description":"Values for the flow's data points, by the names its source reads them under, e.g. the plan or use case a sign-up chose. Ask the flow's chat which names it reads. A name must match exactly, case included; the response lists the others in `ignored_fields`. Details with keys of their own, such as a contact's title or company domain, go in those keys, not here.","examples":[{"plan":"pro","seats":12}]}},"additionalProperties":false,"type":"object","title":"FlowAccount","description":"A company to add to a flow, with at least a `name` or a `domain`."},"FlowContact":{"properties":{"email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"Email","description":"Their email, work or personal. A personal address, such as Gmail, identifies them and finds their profile and work email; the flow emails that address only when its source records that they agreed to it.","examples":["jane@acme.com"]},"linkedin_profile_url":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Linkedin Profile Url","description":"Their LinkedIn profile URL.","examples":["https://www.linkedin.com/in/jane-doe"]},"first_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Last Name"},"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"Their full name, when it is not split in two."},"title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Title","description":"Their job title."},"company_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Company Name"},"company_domain":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Company Domain","description":"Their company's website or domain.","examples":["acme.com"]},"fields":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string","maxLength":3000},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"type":"object"},{"type":"null"}],"title":"Fields","description":"Values for the flow's data points, by the names its source reads them under, e.g. the plan or use case a sign-up chose. Ask the flow's chat which names it reads. A name must match exactly, case included; the response lists the others in `ignored_fields`. Details with keys of their own, such as a contact's title or company domain, go in those keys, not here.","examples":[{"plan":"pro","use_case":"Outbound to logistics companies"}]}},"additionalProperties":false,"type":"object","title":"FlowContact","description":"A person to add to a flow, with at least an `email` or a `linkedin_profile_url`."},"GenerateContactAsyncAcceptedResponse":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Unique identifier for the async job."},"status":{"type":"string","const":"accepted","title":"Status","description":"The job has been accepted for processing.","default":"accepted"}},"additionalProperties":false,"type":"object","required":["job_id"],"title":"GenerateContactAsyncAcceptedResponse","description":"Response returned when an async contact generation job is accepted."},"GenerateContactAsyncJobResponse":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"The job identifier."},"status":{"type":"string","enum":["processing","completed","failed"],"title":"Status","description":"`processing` until generation finishes, then `completed` or `failed`."},"result":{"anyOf":[{"$ref":"#/components/schemas/GenerateContactResponse-Output"},{"type":"null"}],"description":"The generation result (present when status is 'completed')."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message (present when status is 'failed')."}},"additionalProperties":false,"type":"object","required":["job_id","status"],"title":"GenerateContactAsyncJobResponse","description":"The state of an async contact generation job.\n\nOnce the job finishes, this is the same payload the callback receives."},"GenerateContactAsyncRequest":{"properties":{"campaign_id":{"type":"string","maxLength":200,"minLength":20,"title":"Campaign Id","description":"An identifier for the Twain campaign to use as configuration.\n\nThe `campaign_id` is retrieved by pressing the \"...\" menu on the Campaign and selecting \"Copy ID\".\n","examples":["<your-campaign-id>"]},"contact":{"$ref":"#/components/schemas/ValidatedContact","description":"Information about the contact to generate the message for. The legacy field name `recipient` is still accepted as input for backwards compatibility.","examples":[{"custom_variables":[],"linkedin_profile_url":"https://linkedin.com/in/mohamed-chahin-founder-twain","work_email":"mc@usetwain.com"}]},"add_contact_to_campaign":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Add Contact To Campaign","description":"Add/store the contact in the campaign in Twain's UI. (Updates the contact if it already exists). By default the contact is not added to the campaign. The legacy field name `add_lead_to_campaign` is still accepted as input for backwards compatibility.","examples":[false]},"mode":{"anyOf":[{"$ref":"#/components/schemas/PublicGenerationMode"},{"type":"null"}],"description":"How much research and reasoning to spend on the Contact. Each mode costs a\ndifferent number of credits:\n\n- `BASE` (1 credit): minimal research,\n  the fastest and cheapest option.\n- `HIGH` (2 credits): the standard\n  research depth, plus a qualification `thesis` for the Contact.\n- `ULTRA` (8 credits plus 2 per sequence step): the deepest\n  research, plus a written outreach reasoning that guides how the messages\n  are planned, and both a `thesis` and a `strategy` for the Contact.\n\n`mode` is optional. Omitting it runs `HIGH`, and the\nrequest is then treated exactly as if it had asked for\n`HIGH`: same research, same price, same `thesis`, and the\nContact is stored as `HIGH`. Send `mode` to pick a\ndifferent depth rather than to opt into this behaviour.\n\nEvery request runs at the selected mode, including regenerations of an\nexisting Contact. When the Contact is stored in the campaign, the new mode\nand its analysis replace those from the previous generation.\nThe response's `credits_used` reports what the request was actually charged;\nprefer it over deriving the charge from the mode.\n\nProviding `mode` is the current way to request a generation. It cannot be\ncombined with the deprecated `generate_sequence` / `generate_research`\nflags.\n","examples":["HIGH"]},"callback_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Url","description":"URL where the result will be POSTed when generation completes. Must use HTTPS. Leave it out to read the result with `GET /Campaigns/{campaign_id}/Jobs/{job_id}` instead.","examples":["https://your-server.com/webhook/twain"]}},"additionalProperties":false,"type":"object","required":["campaign_id","contact"],"title":"GenerateContactAsyncRequest","description":"Async version of GenerateContactRequest whose result is delivered to a callback URL or read by `job_id`."},"GenerateContactCallbackPayload":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"The job identifier."},"status":{"type":"string","enum":["completed","failed"],"title":"Status","description":"Whether the generation succeeded or failed."},"result":{"anyOf":[{"$ref":"#/components/schemas/GenerateContactResponse-Input"},{"type":"null"}],"description":"The generation result (present when status is 'completed')."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message (present when status is 'failed')."}},"additionalProperties":false,"type":"object","required":["job_id","status"],"title":"GenerateContactCallbackPayload","description":"Payload delivered to the callback URL when async generation completes or fails."},"GenerateContactResponse-Input":{"properties":{"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/SequenceMessage"},"type":"array"},{"type":"null"}],"title":"Messages","description":"Personalized messages for each step (present when generate_sequence=True)."},"subject_line":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Line","description":"Personalized subject line (present when generate_sequence=True and sequence contains email steps)."},"research":{"anyOf":[{"$ref":"#/components/schemas/SequenceResearch-Input"},{"type":"null"}],"description":"Excerpt of research about the Contact."},"thesis":{"anyOf":[{"$ref":"#/components/schemas/Thesis"},{"type":"null"}],"description":"Why the Contact qualifies. Present for the `HIGH` and `ULTRA` modes. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"strategy":{"anyOf":[{"$ref":"#/components/schemas/Strategy"},{"type":"null"}],"description":"How to approach the Contact. Present for the `ULTRA` mode. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"mode":{"anyOf":[{"$ref":"#/components/schemas/PublicGenerationMode"},{"type":"null"}],"description":"The mode the generation ran at, whether it was requested or defaulted. When the Contact is stored, regenerating it replaces its previous mode with this one. `null` only when the request generated no sequence, since the mode prices and shapes sequence generation.","examples":["HIGH"]},"credits_used":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Credits Used","description":"The Twain credits this request was charged. Read it from here rather than deriving it from `mode`: the price is not a pure function of the mode. `null` for requests not billed in Twain credits, such as those made with a partner (Clay) API key.","examples":[2]},"warnings":{"$ref":"#/components/schemas/ContactWarnings","description":"Warnings about the contact."},"persona":{"anyOf":[{"$ref":"#/components/schemas/ContactPersona"},{"type":"null"}],"description":"The persona chosen for this contact's generation."},"link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link","description":"Link to the contact in Twain's UI."}},"additionalProperties":false,"type":"object","title":"GenerateContactResponse","description":"Combined response for sequence and/or research generation."},"GenerateContactResponse-Output":{"properties":{"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/SequenceMessage"},"type":"array"},{"type":"null"}],"title":"Messages","description":"Personalized messages for each step (present when generate_sequence=True)."},"subject_line":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Line","description":"Personalized subject line (present when generate_sequence=True and sequence contains email steps)."},"research":{"anyOf":[{"$ref":"#/components/schemas/SequenceResearch-Output"},{"type":"null"}],"description":"Excerpt of research about the Contact."},"thesis":{"anyOf":[{"$ref":"#/components/schemas/Thesis"},{"type":"null"}],"description":"Why the Contact qualifies. Present for the `HIGH` and `ULTRA` modes. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"strategy":{"anyOf":[{"$ref":"#/components/schemas/Strategy"},{"type":"null"}],"description":"How to approach the Contact. Present for the `ULTRA` mode. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"mode":{"anyOf":[{"$ref":"#/components/schemas/PublicGenerationMode"},{"type":"null"}],"description":"The mode the generation ran at, whether it was requested or defaulted. When the Contact is stored, regenerating it replaces its previous mode with this one. `null` only when the request generated no sequence, since the mode prices and shapes sequence generation.","examples":["HIGH"]},"credits_used":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Credits Used","description":"The Twain credits this request was charged. Read it from here rather than deriving it from `mode`: the price is not a pure function of the mode. `null` for requests not billed in Twain credits, such as those made with a partner (Clay) API key.","examples":[2]},"warnings":{"$ref":"#/components/schemas/ContactWarnings","description":"Warnings about the contact."},"persona":{"anyOf":[{"$ref":"#/components/schemas/ContactPersona"},{"type":"null"}],"description":"The persona chosen for this contact's generation."},"link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link","description":"Link to the contact in Twain's UI."}},"additionalProperties":false,"type":"object","title":"GenerateContactResponse","description":"Combined response for sequence and/or research generation."},"GenerateSequenceSyncRequest":{"properties":{"campaign_id":{"type":"string","maxLength":200,"minLength":20,"title":"Campaign Id","description":"An identifier for the Twain campaign to use as configuration.\n\nThe `campaign_id` is retrieved by pressing the \"...\" menu on the Campaign and selecting \"Copy ID\".\n","examples":["<your-campaign-id>"]},"contact":{"$ref":"#/components/schemas/ValidatedContact","description":"Information about the contact to generate the message for. The legacy field name `recipient` is still accepted as input for backwards compatibility.","examples":[{"custom_variables":[],"linkedin_profile_url":"https://linkedin.com/in/mohamed-chahin-founder-twain","work_email":"mc@usetwain.com"}]},"add_contact_to_campaign":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Add Contact To Campaign","description":"Add/store the contact in the campaign in Twain's UI. (Updates the contact if it already exists). By default the contact is not added to the campaign. The legacy field name `add_lead_to_campaign` is still accepted as input for backwards compatibility.","examples":[false]},"mode":{"anyOf":[{"$ref":"#/components/schemas/PublicGenerationMode"},{"type":"null"}],"description":"How much research and reasoning to spend on the Contact. Each mode costs a\ndifferent number of credits:\n\n- `BASE` (1 credit): minimal research,\n  the fastest and cheapest option.\n- `HIGH` (2 credits): the standard\n  research depth, plus a qualification `thesis` for the Contact.\n- `ULTRA` (8 credits plus 2 per sequence step): the deepest\n  research, plus a written outreach reasoning that guides how the messages\n  are planned, and both a `thesis` and a `strategy` for the Contact.\n\n`mode` is optional. Omitting it runs `HIGH`, and the\nrequest is then treated exactly as if it had asked for\n`HIGH`: same research, same price, same `thesis`, and the\nContact is stored as `HIGH`. Send `mode` to pick a\ndifferent depth rather than to opt into this behaviour.\n\nEvery request runs at the selected mode, including regenerations of an\nexisting Contact. When the Contact is stored in the campaign, the new mode\nand its analysis replace those from the previous generation.\nThe response's `credits_used` reports what the request was actually charged;\nprefer it over deriving the charge from the mode.\n\nProviding `mode` is the current way to request a generation. It cannot be\ncombined with the deprecated `generate_sequence` / `generate_research`\nflags.\n","examples":["HIGH"]}},"additionalProperties":false,"type":"object","required":["campaign_id","contact"],"title":"GenerateSequenceSyncRequest","description":"Generate a sequence based on configuration from Twain's website and information about the Contact.\n\nA Contact must always be provided with at least one of: `linkedin_profile_url`, `work_email` or `company_website`."},"GenerateSequenceSyncResponse":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/SequenceMessage"},"type":"array","title":"Messages","description":"A list of researched and personalized messages for each step in the sequence associated with the `campaign_id`."},"subject_line":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Line","description":"A personalized subject line for the Contact's sequence if the sequence contains at least one email-based message.","examples":["A personalized subject line"]},"research":{"$ref":"#/components/schemas/SequenceResearch-Output","description":"Information enriched/researched about the Contact and their company."},"thesis":{"anyOf":[{"$ref":"#/components/schemas/Thesis"},{"type":"null"}],"description":"Why the Contact qualifies. Present for the `HIGH` and `ULTRA` modes. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"strategy":{"anyOf":[{"$ref":"#/components/schemas/Strategy"},{"type":"null"}],"description":"How to approach the Contact. Present for the `ULTRA` mode. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI."},"mode":{"anyOf":[{"$ref":"#/components/schemas/PublicGenerationMode"},{"type":"null"}],"description":"The mode the generation ran at, whether it was requested or defaulted. When the Contact is stored, regenerating it replaces its previous mode with this one. `null` only when the request generated no sequence, since the mode prices and shapes sequence generation.","examples":["HIGH"]},"credits_used":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Credits Used","description":"The Twain credits this request was charged. Read it from here rather than deriving it from `mode`: the price is not a pure function of the mode. `null` for requests not billed in Twain credits, such as those made with a partner (Clay) API key.","examples":[2]},"warnings":{"$ref":"#/components/schemas/ContactWarnings","description":"Warnings about the contact."},"persona":{"anyOf":[{"$ref":"#/components/schemas/ContactPersona"},{"type":"null"}],"description":"The persona chosen and used for the generation and research associated with the Contact."},"link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link","description":"A link to the contact in Twain's UI","examples":["https://twain.ai/w/<workspace>/campaign/<campaign>/contact/<contact>"]}},"additionalProperties":false,"type":"object","required":["messages","research"],"title":"GenerateSequenceSyncResponse"},"GetAgentsResponse":{"properties":{"agents":{"items":{"$ref":"#/components/schemas/Agent"},"type":"array","title":"Agents","description":"A list of agents for the account/team associated with the API key ordered by update time."}},"additionalProperties":false,"type":"object","required":["agents"],"title":"GetAgentsResponse"},"GetCampaignsResponse":{"properties":{"campaigns":{"items":{"$ref":"#/components/schemas/Campaign"},"type":"array","title":"Campaigns","description":"A list campaigns for the account/team associated with the API key ordered by update time."}},"additionalProperties":false,"type":"object","required":["campaigns"],"title":"GetCampaignsResponse"},"GetCreditsResponse":{"properties":{"credits":{"anyOf":[{"type":"integer"},{"type":"number"}],"title":"Credits","description":"The amount of Twain credits available for the account/team associated with the API key."}},"additionalProperties":false,"type":"object","required":["credits"],"title":"GetCreditsResponse"},"GetWorkflowsResponse":{"properties":{"workflows":{"items":{"$ref":"#/components/schemas/Workflow"},"type":"array","title":"Workflows","description":"A list of workflows for the account/team associated with the API key ordered by update time. Workflows whose campaign was deleted, or whose steps were all removed, are left out."}},"additionalProperties":false,"type":"object","required":["workflows"],"title":"GetWorkflowsResponse"},"GetWorkspacesResponse":{"properties":{"workspaces":{"items":{"$ref":"#/components/schemas/Workspace"},"type":"array","title":"Workspaces","description":"A list of workspaces accessible to the account/team associated with the API key."}},"additionalProperties":false,"type":"object","required":["workspaces"],"title":"GetWorkspacesResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Insight":{"properties":{"insight":{"type":"string","title":"Insight","description":"An insight about the Contact or the Contact's company. The insight aims to be relevant in context of the Campaign's Persona and/or Idea when this is possible for the Contact."},"references":{"anyOf":[{"items":{"$ref":"#/components/schemas/Reference"},"type":"array"},{"type":"null"}],"title":"References","description":"The list of references/sources used to derive the insight."}},"additionalProperties":false,"type":"object","required":["insight"],"title":"Insight"},"Person":{"properties":{"linkedin_profile_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linkedin Profile Url","description":"The Linkedin profile URL of the person.","examples":["https://www.linkedin.com/in/mohamed-chahin-founder-twain/"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The full name of the person.","examples":["Mohamed Chahin"]},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name","description":"The cleaned first name of the person.","examples":["Mohamed"]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name","description":"The cleaned last name of the person.","examples":["Chahin"]},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location","description":"The location of the person with their company.","examples":["Germnay, Berlin"]},"headline":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headline","description":"The headline from their LinkedIn profile.","examples":["Founder & CEO @Twain"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email of the contact. Finding email is not supported in the API yet, so will only contain an email if one was provided.","examples":["mo@twain.ai"]},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"The job title of the contact.","examples":["Founder & CEO"]},"career":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Career","description":"A summary of their career/experiences.","examples":["Mohamed Chahin founded Twain as CEO in December 2021. Prior to Twain, Mohamed co-founded eatclever, which was acquired by PWB in 2022. Earlier in Mohamed's career, he worked at resmio GmbH."]}},"additionalProperties":false,"type":"object","title":"Person"},"PublicGenerationMode":{"type":"string","enum":["BASE","HIGH","ULTRA"],"title":"PublicGenerationMode","description":"How much research and reasoning to spend on a Contact.\n\n`BASE` is the cheapest and shallowest, `ULTRA` the deepest."},"RateLimitResponse":{"properties":{"message":{"type":"string","title":"Message"},"code":{"type":"integer","const":429,"title":"Code","examples":[429]}},"type":"object","required":["message","code"],"title":"RateLimitResponse"},"Reference":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"The title for the website. Typically just the base domain.","examples":["nytimes.com"]},"link":{"type":"string","title":"Link","description":"The link to the actual reference. Typically 1-2 redirects to get to the actual site.","examples":["redictingurl.com/path"]}},"additionalProperties":false,"type":"object","required":["link"],"title":"Reference"},"ResearchSection":{"properties":{"markdown":{"type":"string","title":"Markdown","description":"Research section content formatted as markdown"}},"type":"object","required":["markdown"],"title":"ResearchSection","description":"A section of expanded research in markdown format"},"SequenceMessage":{"properties":{"message":{"type":"string","title":"Message","description":"The generated message for a specific step in the sequence. A call step (see `channel`) carries a script: one `Label: spoken text` paragraph per segment, separated by blank lines.","examples":["Hi Mohamed,\n\nDo you think your recent plans for ramping up Twain’s outreach will change the way you approach prospecting?\n\nSince you’re focusing on adapting your outbound strategy and building AI-native stacks to drive ROI, I figured it might help to share how Clay automates lead generation, saving hours and helping companies like Notion auto-approve about 40% of startups for their programme.\n\nHow have you managed prospecting for Twain’s outreach so far?"]},"subject_line":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Line","description":"A personalized subject line for this specific message, when the campaign uses subject line frameworks."},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel","description":"The channel step type of this message (e.g. EMAIL_INTRO, LINKEDIN_CR, CALL_VOICEMAIL). Additive: omitted on runs generated before the field existed."}},"additionalProperties":false,"type":"object","required":["message"],"title":"SequenceMessage"},"SequenceResearch-Input":{"properties":{"person":{"anyOf":[{"$ref":"#/components/schemas/Person"},{"type":"null"}],"description":"The researched information specific to the Person/Contact."},"company":{"anyOf":[{"$ref":"#/components/schemas/Company"},{"type":"null"}],"description":"Researched information about the Person's company. If only LinkedIn URL is provided and the Contact has multiple active positions, we'll choose the position most aligned with the campaign."},"insights":{"anyOf":[{"items":{"$ref":"#/components/schemas/Insight"},"type":"array"},{"type":"null"}],"title":"Insights","description":"Insights about the Person or Company, researched with a focus on relevance to the campaign. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI.","examples":[{"insight":"Mohamed Chahin, CEO of Twain, discusses evolving outbound email strategies, noting that 2020 methods are no longer effective. He focuses on adapting outreach to contemporary challenges. (ARRtist SUMMIT Program, July 2025)"},{"insight":"Mohamed Chahin advocates for building AI-native tool stacks for revenue teams to achieve real ROI. This emphasizes leveraging AI for scalable and efficient go-to-market operations and optimizing outreach. (ARRtist SUMMIT Program, July 2025)"},{"insight":"Mohamed Chahin addresses challenges of personalization at scale for sales teams. Twain offers 1:1 personalized messages with human-level quality, solving the dilemma of scaling outreach without sacrificing authenticity. (Top 10 Best Cold Email Tools for Effective Outreach, Dec 2024)"}]}},"additionalProperties":false,"type":"object","title":"SequenceResearch","description":"An excerpt of some the research that Twain conducts about the Contact and their company."},"SequenceResearch-Output":{"properties":{"person":{"anyOf":[{"$ref":"#/components/schemas/Person"},{"type":"null"}],"description":"The researched information specific to the Person/Contact."},"company":{"anyOf":[{"$ref":"#/components/schemas/Company"},{"type":"null"}],"description":"Researched information about the Person's company. If only LinkedIn URL is provided and the Contact has multiple active positions, we'll choose the position most aligned with the campaign."},"insights":{"anyOf":[{"items":{"$ref":"#/components/schemas/Insight"},"type":"array"},{"type":"null"}],"title":"Insights","description":"Insights about the Person or Company, researched with a focus on relevance to the campaign. Pro, Enterprise and the free trial only: omitted on the Starter plan, where it stays in Twain's UI.","examples":[{"insight":"Mohamed Chahin, CEO of Twain, discusses evolving outbound email strategies, noting that 2020 methods are no longer effective. He focuses on adapting outreach to contemporary challenges. (ARRtist SUMMIT Program, July 2025)"},{"insight":"Mohamed Chahin advocates for building AI-native tool stacks for revenue teams to achieve real ROI. This emphasizes leveraging AI for scalable and efficient go-to-market operations and optimizing outreach. (ARRtist SUMMIT Program, July 2025)"},{"insight":"Mohamed Chahin addresses challenges of personalization at scale for sales teams. Twain offers 1:1 personalized messages with human-level quality, solving the dilemma of scaling outreach without sacrificing authenticity. (Top 10 Best Cold Email Tools for Effective Outreach, Dec 2024)"}]}},"additionalProperties":false,"type":"object","title":"SequenceResearch","description":"An excerpt of some the research that Twain conducts about the Contact and their company."},"Strategy":{"properties":{"markdown":{"type":"string","title":"Markdown","description":"The full strategy as markdown, one `##` headline per section.","examples":["## Level Alignment\n\n- Company-level and contact-level signals agree; lead on the contact's own posts.\n\n## Risks\n\n- Their recent hiring push is public but two months old."]}},"additionalProperties":false,"type":"object","required":["markdown"],"title":"Strategy","description":"How to approach this Contact: risks, channel, tone, proof, and sequencing.\n\nPopulated for the `ULTRA` mode only, which is the one mode that computes the\noutreach reasoning this is distilled from. Single rendered `markdown` field,\nfor the same reason as `Thesis`."},"Thesis":{"properties":{"markdown":{"type":"string","title":"Markdown","description":"The full thesis as markdown, one `##` headline per section.","examples":["## Prospect Narrative\n\nMohamed founded Twain in December 2021 after co-founding eatclever.\n\n## Persona Fit\n\n- Founder & CEO of a 1-10 person company, matching the campaign's CEO persona."]}},"additionalProperties":false,"type":"object","required":["markdown"],"title":"Thesis","description":"Why this Contact qualifies: their story, their persona fit, and the timing.\n\nPopulated for the `HIGH` and `ULTRA` modes. Only a single rendered\n`markdown` field for now — the sections are still moving, so a client that\nrenders markdown does not break when one is added or renamed."},"UnauthenticatedResponse":{"properties":{"message":{"type":"string","title":"Message"},"code":{"type":"integer","const":401,"title":"Code","examples":[401]}},"additionalProperties":false,"type":"object","required":["message","code"],"title":"UnauthenticatedResponse"},"ValidatedContact":{"properties":{"linkedin_profile_url":{"anyOf":[{"type":"string","pattern":".*linkedin\\.com/(in|sales/((lead|people)))/.+"},{"type":"null"}],"title":"Linkedin Profile Url","description":"LinkedIn profile is the preferred identifier for the Recipient. Twain will fetch the real-time information from their LinkedIn profile as the basis for the rest of our research.","examples":["https://www.linkedin.com/in/mohamed-chahin-founder-twain/"]},"work_email":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Work Email","description":"The work email of the lead.","examples":["mo@twain.ai"]},"company_domain":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Company Domain","description":"The domain/website of the company of the Recipient.","examples":["twain.ai"]},"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name","description":"Optional name for the lead to use for greetings or person specific research. Will be extracted from LinkedIn when `linkedin_profile_url` is provided.","examples":["Mohamed Chahin"]},"extra_information":{"anyOf":[{"type":"string","maxLength":3000},{"type":"null"}],"title":"Extra Information","description":"Optional extra information you want inform Twain of about the Recipient.","examples":["Mo is an existing user of Twain and has been vocal about his use of Twain on LinkedIn."]},"custom_variables":{"anyOf":[{"items":{"$ref":"#/components/schemas/CustomVariable"},"type":"array"},{"type":"null"}],"title":"Custom Variables"},"trigger":{"anyOf":[{"type":"string","maxLength":3000},{"type":"null"}],"title":"Trigger","description":"A lead-specific trigger that prompted the sender to reach out to this specific recipient.","examples":["Mo has posted on LinkedIn that they want to ramp up their outreach in the coming months."]},"attio_record_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attio Record Id","description":"Attio record ID — provenance + dedupe key for Attio-sourced workflow jobs."},"headline":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headline","description":"The recipient's LinkedIn headline, when the source already has it."},"conversation_messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/ApiConversationMessage"},"type":"array"},{"type":"null"}],"title":"Conversation Messages","description":"Prior conversation thread with this Contact (e.g. LinkedIn/HeyReach messages), oldest message first. Twain formats it into a compact transcript (most-recent messages kept, capped at ~3000 characters) and uses it as context so the generated message continues the relationship instead of cold-opening."}},"additionalProperties":false,"type":"object","title":"ValidatedContact","description":"A Contact with additional validation for the Public API.\n\nA Contact must have at least one of `linkedin_profile_url`, `work_email` or\n`company_domain` provided."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"Workflow":{"properties":{"workflow_id":{"type":"string","title":"Workflow Id","description":"The ID of the workflow, shown as the Automation ID in Twain's UI."},"name":{"type":"string","title":"Name","description":"The name of the workflow as seen in Twain's UI"},"campaign_id":{"type":"string","title":"Campaign Id","description":"The campaign the workflow generates for. In Twain's UI the workflow is that campaign's Automation."},"url":{"type":"string","title":"Url","description":"A direct link to the campaign's Automation in Twain's UI"}},"type":"object","required":["workflow_id","name","campaign_id","url"],"title":"Workflow"},"WorkflowQueueUnavailableResponse":{"properties":{"message":{"type":"string","title":"Message"},"code":{"type":"string","const":"WORKFLOW_QUEUE_UNAVAILABLE","title":"Code","examples":["WORKFLOW_QUEUE_UNAVAILABLE"]}},"additionalProperties":false,"type":"object","required":["message","code"],"title":"WorkflowQueueUnavailableResponse","description":"503: Twain could not queue the contact for the workflow right now.\n\nNothing was queued or charged, so the same request can be re-sent after\nthe delay (in seconds) named in the ``Retry-After`` header. Unlike\n``capacity_exhausted`` this is not about research capacity: the workflow\nbackend did not accept the job at all, typically while it was scaling out."},"Workspace":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"The ID of the workspace."},"name":{"type":"string","title":"Name","description":"The name of the workspace as seen in Twain's UI"},"type":{"type":"string","enum":["team","private"],"title":"Type","description":"The workspace type: 'team' for shared team workspaces or 'private' for personal workspaces."}},"type":"object","required":["workspace_id","name","type"],"title":"Workspace"}},"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"x-api-key"}}},"tags":[{"name":"MCP server","description":"Everything in this API is also available as tools over MCP, and the MCP server covers more of Twain than the endpoints documented here. Beyond listing campaigns, generating for a contact, and adding a contact to a campaign's automation, an assistant can:\n\n- **Set up from scratch**: create a workspace, build an agent from a company website with the customer segments and rules Twain suggests for it, and create a campaign from a [campaign brief](https://www.twain.ai/blog/campaign-brief) the assistant collects one question at a time and shows you before saving (`create_workspace`, `suggest_agent_setup`, `create_agent`, `preview_campaign`, `create_campaign`).\n- **Import contacts in bulk**: add many contacts to a campaign for free, then generate, review, and export them in Twain (`add_contacts_to_campaign`).\n- **Revise a campaign**: switch a step to another framework (one of Twain's, one saved in the workspace, or one written for the campaign) or change its message length, change how its messages are written by describing the change (\"drop the P.S.\"), and regenerate a contact's whole sequence or single steps, free at the mode it was generated with (`get_campaign_step`, `update_campaign_step`, `edit_campaign_instructions`, `regenerate_contact`).\n- **Read results back**: fetch a generated contact's messages and analysis, list a campaign's contacts, and follow a generation until it finishes (`get_contact`, `list_contacts`, `get_generation_status`, `list_generation_jobs`).\n- **Inspect setup and spend**: read an automation's configuration and price per contact, and a campaign's activity log with the credits each action charged (`get_workflow`, `get_campaign_log`).\n- **Manage integrations**: list the CRMs, sequencers, and Slack you have connected, and get a one-use Twain link to connect another one (`list_integrations`, `connect_integration`).\n- **Export to your stack**: send a campaign's generated contacts and messages to a connected sequencer or CRM, with a field mapping the assistant suggests and you confirm before anything is sent (`get_export_options`, `list_export_destinations`, `export_campaign`).\n- **Send feedback** to the Twain team from the chat (`give_feedback`).\n\nThe server speaks streamable HTTP at `https://mcp.api.twain.ai`, and accepts either a Twain sign-in or an API key — both unlock every tool.\n\n**Claude and ChatGPT** (web and desktop apps) have no field for a custom header, so they connect with a sign-in instead: paste `https://mcp.api.twain.ai` as a custom connector (Claude: Settings > Connectors; ChatGPT: Developer mode > create an app) and authorize with your Twain account when prompted.\n\n**Clients that let you set a header** take an API key directly. To get yours, open Twain, click your name at the bottom of the left sidebar, and choose _API key_ — the key is created the first time you open that dialog, and _Copy Key_ puts it on your clipboard. You can come back and copy it again at any time. Verify your email address first, and note that the same single key serves both this API and MCP.\n\n_Claude Code_\n\n```sh\nclaude mcp add --transport http twain https://mcp.api.twain.ai --header \"X-Api-Key: <your-twain-api-key>\"\n```\n\n_Cursor_ — add to `~/.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"twain\": {\n      \"url\": \"https://mcp.api.twain.ai\",\n      \"headers\": { \"X-Api-Key\": \"<your-twain-api-key>\" }\n    }\n  }\n}\n```\n\n_Codex_ (ChatGPT desktop app, CLI, and IDE extension) — add to `~/.codex/config.toml`:\n\n```toml\n[mcp_servers.twain]\nurl = \"https://mcp.api.twain.ai\"\nhttp_headers = { \"X-Api-Key\" = \"<your-twain-api-key>\" }\n```\n\n_Any other client_ — point it at the server URL and send the key as a header:\n\n```json\n{\n  \"url\": \"https://mcp.api.twain.ai\",\n  \"headers\": { \"X-Api-Key\": \"<your-twain-api-key>\" }\n}\n```\n\nSee the [MCP guide](https://www.twain.ai/blog/mcp-server) for the full per-client walkthrough."},{"name":"Campaigns","description":"List and generate for your personal and team's shared campaigns."},{"name":"Workflows","description":"List workflows and add contacts to them for automated processing. A workflow is a campaign's Automation in Twain's UI. Costs depend on the workflow's setup.","x-displayName":"Automations"},{"name":"Account","description":"Inspect account-level resources: available credits, workspaces, and agents."},{"name":"Flows","description":"Send contacts or accounts to a flow in Twain Flow, which runs each one through its steps. Flow is in a closed beta: these endpoints work for accounts with Flow turned on."}],"servers":[{"url":"/v2"}]}