{"openapi":"3.2.0","info":{"title":"Flownally API","version":"1.0.0","description":"Build customer messaging, contact context, and automated journeys on top of Flownally.\nUse the API to connect channels, send and follow messages, keep contacts in sync, and\ntrigger journeys from the systems your team already uses.\n\n## IDs\n\nIDs are opaque strings. The prefix names the resource type, for example `cnv_` for\nconversations and `msg_` for messages. Don't parse IDs or depend on their length.\n\n## Timestamps\n\nDate-time fields are RFC 3339 timestamps in UTC with second precision, for example\n`2026-04-30T10:36:00Z`. A message's `createdAt` is the exception: it has exactly six\nfractional digits (microseconds), for example `2026-04-30T10:36:00.412305Z`, so comparing\nthe strings orders messages.\n\n## Rate limits\n\nRequests are rate limited per client IP address. A request over the limit gets\n`429 Too Many Requests` without a Problem Details body and without a `Retry-After` header.\nRetry with exponential backoff and jitter.\n"},"externalDocs":{"description":"Learn more about Flownally","url":"https://flownally.com"},"servers":[{"url":"https://api.flownally.com/v1","description":"Flownally public API","x-ogen-server-name":"production"},{"url":"http://localhost:8080/v1","description":"Local gateway API","x-ogen-server-name":"local"}],"tags":[{"name":"Reports","description":"Query retained customer, channel, agent, bot, and campaign activity with explicit date anchors."},{"name":"Messaging","description":"Send, receive, and follow customer conversations across connected channels. For outbound\nmessaging, choose an inbox, optionally upload media, send a message, then poll the message\nresource for delivery state when you are not using webhooks.\n"},{"name":"Inboxes","description":"Connect channels and choose where conversations enter your Flownally workspace."},{"name":"Contacts","description":"Keep customer profiles, tags, custom fields, and imports in sync."},{"name":"Journeys","description":"Guide contacts through timely, event-driven customer journeys."},{"name":"Chatbots","description":"Publish automated chat flows that can answer, qualify, and hand over."},{"name":"Events","description":"Record customer moments that can trigger journeys and enrich contact history."},{"name":"Teams","description":"Organize teammates and route conversations to the right group."},{"name":"Users","description":"Manage the people working in your Flownally workspace."},{"name":"Billing","description":"Review subscription state and open hosted billing sessions."},{"name":"API Keys","description":"Create service accounts and API keys for server-to-server integrations."},{"name":"Webhooks","description":"Configure signed webhook deliveries for contacts, conversations, and messages."}],"paths":{"/inboxes":{"get":{"operationId":"getInboxes","summary":"List inboxes","description":"Returns every inbox in the workspace, oldest first. An inbox is one connected channel\naccount, such as a WhatsApp number or a Facebook Page. Pass an inbox `id` as `inboxId`\nto choose the sender when you send a message.\n","security":[{"bearerAuth":["inbox:list"]}],"responses":{"200":{"description":"List of inboxes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxesResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:list"],"roles":["owner","admin","agent"],"description":"List inboxes in the workspace."}},"post":{"operationId":"createInbox","summary":"Connect inboxes","description":"Connects Facebook Pages, Instagram accounts, Twilio phone numbers or a LiveChat\norganization, and returns an inbox for each account connected. Send one channel per\nrequest.\n\n- Messenger and Instagram: Flownally must already have Meta access to each Page or\n  account. One that can't be connected is skipped, and the request fails only when none\n  can be. A Page or account already connected in this workspace returns its existing\n  inbox.\n- Twilio: call `POST /twilio/{accountSid}/phone-numbers` first to get a\n  `pendingCredentialId`. Connecting a number replaces its incoming message webhook and\n  status callback in Twilio.\n\nWhatsApp can't be connected through this endpoint; connect it in the Flownally app.\n","security":[{"bearerAuth":["inbox:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInboxRequest"}}}},"responses":{"200":{"description":"Inboxes connected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInboxResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:create"],"roles":["owner","admin"],"description":"Create an inbox in the workspace."}}},"/inboxes/{id}":{"delete":{"operationId":"deleteInboxByID","summary":"Delete inbox","description":"Removes an inbox from the workspace so it can no longer receive or send messages. Its\nforwarding rules are deleted, and rules in other inboxes that forward to it stop\nforwarding.\n","security":[{"bearerAuth":["inbox:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Inbox deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:delete"],"roles":["owner","admin"],"description":"Delete an inbox in the workspace."}}},"/inboxes/{id}/team":{"put":{"operationId":"setInboxTeam","summary":"Assign team to inbox","description":"Gives new sessions in this inbox's conversations to the team and returns the updated\ninbox. Sessions already open keep their team. Returns `404` with code\n`messaging_inbox_team_not_found` when the team doesn't exist in the workspace.\n","security":[{"bearerAuth":["inbox:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetInboxTeamRequest"}}}},"responses":{"200":{"description":"Updated inbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:update"],"roles":["owner","admin"],"description":"Assign a team to an inbox."}},"delete":{"operationId":"clearInboxTeam","summary":"Remove team from inbox","description":"Removes the inbox's team and returns the updated inbox. New sessions in this inbox's\nconversations start without a team. Sessions already open keep theirs.\n","security":[{"bearerAuth":["inbox:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Updated inbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:update"],"roles":["owner","admin"],"description":"Clear team assignment from an inbox."}}},"/inboxes/{id}/forwarding":{"get":{"operationId":"getInboxForwarding","summary":"Get inbox forwarding","description":"Returns the rules that forward this inbox's sessions to a desk inbox, where agents in\nLiveChat (`textinc`) or Genesys answer them. `rules` is empty when the inbox doesn't\nforward.\n","security":[{"bearerAuth":["inbox:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Forwarding rules","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxForwarding"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:read"],"roles":["owner","admin","agent"],"description":"Read an inbox's forwarding rules."}},"put":{"operationId":"setInboxForwarding","summary":"Set inbox forwarding","description":"Replaces all forwarding rules of this inbox. A session follows the rule of its team, or\nthe default rule (no `teamId`) when its team has none. A rule without `to` keeps those\nsessions in Flownally. Sessions already open keep the rules they started with. An empty\n`rules` list turns forwarding off.\n\nOnly WhatsApp, Messenger, Instagram and Twilio inboxes can forward.\n\n- `400` with code `messaging_forwarding_invalid_rules`: the rules are invalid, for example\n  the inbox is itself a desk inbox, two rules cover the same team or both are default\n  rules, `to` isn't a desk inbox, or `groupId` is set without a LiveChat `to`.\n- `404` with code `messaging_forwarding_inbox_not_found`,\n  `messaging_forwarding_desk_not_found` or `messaging_forwarding_team_not_found`: the\n  inbox, the `to` inbox or a team doesn't exist in the workspace.\n","security":[{"bearerAuth":["inbox:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxForwarding"}}}},"responses":{"200":{"description":"Forwarding rules set","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxForwarding"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:update"],"roles":["owner","admin"],"description":"Replace an inbox's forwarding rules."}},"delete":{"operationId":"clearInboxForwarding","summary":"Turn off inbox forwarding","description":"Removes all forwarding rules of this inbox, so new sessions stay in Flownally. Sessions\nalready open keep the rules they started with.\n","security":[{"bearerAuth":["inbox:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Forwarding turned off"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:update"],"roles":["owner","admin"],"description":"Turn off an inbox's forwarding."}}},"/inboxes/{id}/whatsapp/templates":{"get":{"operationId":"listWhatsAppTemplates","summary":"List WhatsApp templates","description":"Returns the message templates of this inbox's WhatsApp Business Account, whatever their\nstatus. Only `APPROVED` templates can be sent: use their `name` and `language` in\n`template` message content. The inbox must be a WhatsApp inbox; other inboxes return\n`400`.\n","security":[{"bearerAuth":["inbox:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}},{"name":"pageSize","in":"query","required":false,"description":"Number of templates to return. Defaults to 100 and is capped at 1000.","schema":{"type":"integer","minimum":0,"default":100}},{"name":"pageToken","in":"query","required":false,"description":"Token returned as `nextPageToken` from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of WhatsApp templates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplatesResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:read"],"roles":["owner","admin","agent"],"description":"List WhatsApp templates for an inbox."}}},"/inboxes/{id}/whatsapp/flows":{"get":{"operationId":"listWhatsAppFlows","summary":"List WhatsApp Flows","description":"Returns the published WhatsApp Flows of this inbox's WhatsApp Business Account, sorted by\nname. Use a Flow `id` as `flowId` in a rich message card action. The inbox must be a\nWhatsApp inbox; other inboxes return `400`. An inbox connected through 360dialog returns\n`422` with code `messaging_whatsapp_flows_unsupported_provider`.\n","security":[{"bearerAuth":["inbox:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}},{"name":"pageSize","in":"query","required":false,"description":"Number of Flows to return. Defaults to 100 and is capped at 1000.","schema":{"type":"integer","minimum":0,"default":100}},{"name":"pageToken","in":"query","required":false,"description":"Token returned as `nextPageToken` from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of published WhatsApp Flows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppFlowsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:read"],"roles":["owner","admin","agent"],"description":"List published WhatsApp Flows for an inbox."}}},"/inboxes/{inboxId}/instagram/media":{"get":{"operationId":"listInstagramMedia","summary":"List Instagram media","description":"Returns the posts and reels of this inbox's Instagram account, and its active stories when\n`mediaTypes` includes `story`. Use post and reel `id` values as `mediaIds` in a journey's\n`instagram_comment` trigger; stories can't receive comments. Posts and reels come first,\nthen stories.\n\nFlownally filters by `mediaTypes` after reading a page from Instagram, so a page can\nhold fewer items than `pageSize`, or none, and still have a `nextPageToken`. Keep paging\nuntil `nextPageToken` is absent. The inbox must be an Instagram inbox; other inboxes\nreturn `400`.\n","security":[{"bearerAuth":["inbox:read"]}],"parameters":[{"name":"inboxId","in":"path","required":true,"description":"Inbox ID.","schema":{"type":"string"}},{"name":"mediaTypes","in":"query","required":false,"description":"Media types to include. Defaults to `post` and `reel`.","schema":{"type":"array","items":{"$ref":"#/components/schemas/InstagramMediaType"}},"explode":false},{"name":"pageSize","in":"query","required":false,"description":"Number of media items to read from Instagram for this page. Defaults to 50; values\nabove 100 are treated as 100.\n","schema":{"type":"integer","minimum":0,"default":50}},{"name":"pageToken","in":"query","required":false,"description":"Opaque token returned as `nextPageToken` from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Instagram media page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramMediaResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:read"],"roles":["owner","admin","agent"],"description":"List Instagram media available for Journey targeting."}}},"/whatsapp/{wabaId}/phone-numbers":{"get":{"operationId":"listWABAPhoneNumbers","summary":"List WhatsApp phone numbers","description":"Returns the phone numbers on a WhatsApp Business Account that is connected to this\nworkspace, with their verified name, quality rating and registration status. A WhatsApp\ninbox's `config.wabaId` holds the account ID. Returns `503` with code\n`messaging_whatsapp_phone_numbers_unavailable` when WhatsApp can't list the numbers right\nnow; retry later.\n","security":[{"bearerAuth":["inbox:create"]}],"parameters":[{"name":"wabaId","in":"path","required":true,"description":"WhatsApp Business Account ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of phone numbers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WABAPhoneNumbersResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:create"],"roles":["owner","admin"],"description":"List WhatsApp phone numbers available for inbox creation."}}},"/twilio/{accountSid}/phone-numbers":{"post":{"operationId":"listTwilioPhoneNumbers","summary":"List Twilio phone numbers","description":"Returns every phone number on the Twilio account, using the Auth Token in the request\nbody. Flownally keeps the Auth Token as a pending credential for 30 minutes. To connect\nnumbers, pass the returned `pendingCredentialId` and the chosen `phoneNumberSid` values\nto `POST /inboxes` within that time, as the same service account or user.\n","security":[{"bearerAuth":["inbox:create"]}],"parameters":[{"name":"accountSid","in":"path","required":true,"description":"Twilio Account SID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTwilioPhoneNumbersRequest"}}}},"responses":{"200":{"description":"List of Twilio phone numbers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TwilioPhoneNumbersResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Inboxes"],"x-flownally-authz":{"kind":"static","permissions":["inbox:create"],"roles":["owner","admin"],"description":"List Twilio phone numbers available for inbox creation."}}},"/users":{"get":{"operationId":"getUsers","summary":"List users","description":"Returns the members of the workspace.","security":[{"bearerAuth":["user:list"]}],"responses":{"200":{"description":"List of users","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsersResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"static","permissions":["user:list"],"roles":["owner","admin","agent"],"description":"List workspace users."}}},"/users/me":{"get":{"operationId":"getUsersMe","summary":"Get current user profile","description":"Returns the authenticated user's profile.","security":[{"bearerAuth":["user:read_self"]}],"responses":{"200":{"description":"Current user profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"self_or_static","permissions":["user:read_self"],"roles":["owner","admin","agent"],"description":"Read the caller's user record."}},"patch":{"operationId":"patchUsersMe","summary":"Update current user profile","description":"Updates the authenticated user's name or avatar.","security":[{"bearerAuth":["user:update_self"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProfileRequest"}}}},"responses":{"200":{"description":"Updated user profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"self_or_static","permissions":["user:update_self"],"roles":["owner","admin","agent"],"description":"Update the caller's user profile."}}},"/users/me/unread-summary":{"get":{"operationId":"getUsersMeUnreadSummary","summary":"Get unread summary","description":"Returns how many conversations the signed-in user can see have unread activity, across all\nowners and statuses, and whether each requested conversation is unread for them.\n","parameters":[{"name":"skipTotal","in":"query","description":"Return only the flags for `conversationIds`. When true, `unreadConversations` is zero and must be ignored. Defaults to false. Each call reads its own snapshot, so flags and a total from an earlier call can differ.","schema":{"type":"boolean"}},{"in":"query","name":"conversationIds","required":false,"schema":{"type":"array","maxItems":200,"items":{"type":"string"}},"style":"form","explode":false}],"security":[{"bearerAuth":["user:read_self"]}],"responses":{"200":{"description":"Unread summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnreadSummaryResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"self_or_static","permissions":["user:read_self"],"roles":["owner","admin","agent"],"description":"Read the caller's unread conversation summary."}}},"/users/{userId}":{"get":{"operationId":"getUser","summary":"Get user","description":"Returns one workspace member, including role and team membership.","security":[{"bearerAuth":["user:read"]}],"parameters":[{"name":"userId","in":"path","required":true,"description":"User ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"static","permissions":["user:read"],"roles":["owner","admin","agent"],"description":"Read a workspace user."}},"delete":{"operationId":"deleteUser","summary":"Remove member","description":"Removes a member from the workspace and signs them out of the app. The member no longer\nappears in `GET /users`, but past activity, such as messages they sent, still shows who\ndid it.\n","security":[{"bearerAuth":["user:disable"]}],"parameters":[{"name":"userId","in":"path","required":true,"description":"User ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Member removed"},"400":{"description":"Invalid request. Code:\n  - `auth_member_self_removal_forbidden`: you can't remove yourself.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Your role can't remove this member. Codes:\n  - `auth_authz_member_remove_denied`: your role can't remove members.\n  - `auth_member_removal_forbidden`: you can't remove an Owner.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"The user isn't a member of this workspace. Code:\n  - `auth_user_not_found`\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"The workspace must keep at least one Owner. Code:\n  - `auth_user_last_owner_required`: removing this member would leave no active Owner.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"static","permissions":["user:disable"],"roles":["owner","admin"],"description":"Remove a member from the workspace."}}},"/users/{userId}/role":{"put":{"operationId":"putUserRole","summary":"Update member role","description":"Changes a member's role. Admins can switch members between `admin` and `agent`; only\nOwners can make someone an Owner or change an Owner's role. A workspace must keep at least\none Owner, so demoting the last one is rejected.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"userId","in":"path","required":true,"description":"User ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserRoleRequest"}}}},"responses":{"200":{"description":"Member updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"Invalid request. Codes:\n  - `auth_user_invalid_role`: `role` isn't `owner`, `admin` or `agent`.\n  - `auth_user_self_role_change_forbidden`: you can't change your own role.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Your role can't make this change. Codes:\n  - `auth_authz_user_assign_role_denied`: your role can't assign the requested role, for example an Admin assigning `owner`.\n  - `auth_user_role_assignment_forbidden`: you can't change an Owner's role.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"The user isn't a member of this workspace. Code:\n  - `auth_user_not_found`\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"The workspace must keep at least one Owner. Code:\n  - `auth_user_last_owner_required`: this change would leave no Owner.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Users"],"x-flownally-authz":{"kind":"request_dependent","permissions":["user:assign_role_owner","user:assign_role_admin","user:assign_role_agent"],"roles":["owner","admin"],"description":"Assign a user role; required action depends on request body role."}}},"/teams":{"get":{"operationId":"listTeams","summary":"List teams","description":"Returns teams used for inbox routing and conversation access.","security":[{"bearerAuth":["team:list"]}],"parameters":[{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of teams","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTeamsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:list"],"roles":["owner","admin","agent"],"description":"List teams in the workspace."}},"post":{"operationId":"createTeam","summary":"Create team","description":"Creates a team for routing conversations and organizing teammates.","security":[{"bearerAuth":["team:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTeamRequest"}}}},"responses":{"201":{"description":"Team created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:create"],"roles":["owner","admin"],"description":"Create a team in the workspace."}}},"/teams/{id}":{"get":{"operationId":"getTeam","summary":"Get team","description":"Returns one team and its current agent assignments.","security":[{"bearerAuth":["team:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Team details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:read"],"roles":["owner","admin","agent"],"description":"Read a team in the workspace."}},"put":{"operationId":"updateTeam","summary":"Update team","description":"Updates a team's display name or description.","security":[{"bearerAuth":["team:update"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTeamRequest"}}}},"responses":{"200":{"description":"Team updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:update"],"roles":["owner","admin"],"description":"Update a team in the workspace."}},"delete":{"operationId":"deleteTeam","summary":"Delete team","description":"Deletes a team that is no longer used for routing or assignments.","security":[{"bearerAuth":["team:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Team deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:delete"],"roles":["owner","admin"],"description":"Delete a team in the workspace."}}},"/teams/{id}/agents":{"get":{"operationId":"listTeamAgents","summary":"List team agents","description":"Returns users assigned to the team.","security":[{"bearerAuth":["team:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List of agents","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTeamAgentsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:read"],"roles":["owner","admin","agent"],"description":"List agents assigned to a team."}},"post":{"operationId":"addAgentToTeam","summary":"Add agent to team","description":"Adds a user to the team so they can work conversations routed there.","security":[{"bearerAuth":["team:assign_user"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddAgentToTeamRequest"}}}},"responses":{"201":{"description":"Agent added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamMembership"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:assign_user"],"roles":["owner","admin"],"description":"Add an agent to a team."}}},"/teams/{id}/agents/{userId}":{"delete":{"operationId":"removeAgentFromTeam","summary":"Remove agent from team","description":"Removes a user from the team.","security":[{"bearerAuth":["team:remove_user"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Agent removed"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Teams"],"x-flownally-authz":{"kind":"static","permissions":["team:remove_user"],"roles":["owner","admin"],"description":"Remove an agent from a team."}}},"/messages":{"post":{"operationId":"sendMessage","summary":"Send message","description":"Sends a message to the customer that `recipient` points to: an existing conversation, a\ncontact or a phone number. Choose the sending inbox with `GET /inboxes` and pass it as\n`inboxId`; it's required for contact and phone recipients. To send a WhatsApp template,\nfind it with `GET /inboxes/{id}/whatsapp/templates`; to send a file, upload it first with\n`POST /media/uploads`.\n\nThe response is `202 Accepted`. Poll `GET /messages/{id}` or\n`GET /conversations/{id}/messages` to follow delivery state when you are not using\nwebhooks.\n\nA send to a conversation whose customer is banned fails with `422`\n`messaging_customer_banned`; a send by phone number or channel ID may instead be accepted\nand fail later with `failureCode` `customer_banned`.\n\nWhile another responder holds the recipient's conversation (shown as `activeOwner` type\n`external` while its session is open), anything but a WhatsApp template fails with `422`\nand code `messaging_assignment_held_externally`, and nothing is sent.\n","x-codeSamples":[{"lang":"cURL","label":"Send a WhatsApp text","source":"curl -X POST \"https://api.flownally.com/v1/messages\" \\\n  -H \"Authorization: Bearer {token}\" \\\n  -H \"Idempotency-Key: order-4827-text\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"inboxId\": \"ibx_d7pi2efp0k7nba4e1mt0\",\n    \"recipient\": {\n      \"type\": \"phone\",\n      \"phoneNumber\": \"+48123456789\"\n    },\n    \"content\": {\n      \"type\": \"text\",\n      \"text\": {\n        \"body\": \"Hi Anna, your order is ready for pickup.\"\n      }\n    }\n  }'\n"},{"lang":"cURL","label":"Send uploaded media","source":"curl -X POST \"https://api.flownally.com/v1/messages\" \\\n  -H \"Authorization: Bearer {token}\" \\\n  -H \"Idempotency-Key: order-4827-invoice\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"inboxId\": \"ibx_d7pi2efp0k7nba4e1mt0\",\n    \"recipient\": {\n      \"type\": \"phone\",\n      \"phoneNumber\": \"+48123456789\"\n    },\n    \"content\": {\n      \"type\": \"media\",\n      \"media\": {\n        \"mediaId\": \"mda_d7pka1i9v5sfp2ud6chg\",\n        \"caption\": \"Your invoice is attached.\",\n        \"filename\": \"invoice-4827.pdf\",\n        \"mimeType\": \"application/pdf\",\n        \"mediaType\": \"document\"\n      }\n    }\n  }'\n"}],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/MessageIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMessageRequest"},"examples":{"textToPhoneRecipient":{"summary":"Send a text message to a phone recipient","value":{"inboxId":"ibx_d7pi2efp0k7nba4e1mt0","recipient":{"type":"phone","phoneNumber":"+48123456789"},"content":{"type":"text","text":{"body":"Hi Anna, your order is ready for pickup."}}}},"whatsappTemplate":{"summary":"Send a WhatsApp template","value":{"inboxId":"ibx_d7pi2efp0k7nba4e1mt0","recipient":{"type":"phone","phoneNumber":"+48123456789"},"content":{"type":"template","template":{"name":"order_ready","language":"en","components":[{"type":"body","parameters":[{"type":"text","text":"Anna"},{"type":"text","text":"4827"}]}]}}}},"uploadedMedia":{"summary":"Send uploaded media","value":{"inboxId":"ibx_d7pi2efp0k7nba4e1mt0","recipient":{"type":"phone","phoneNumber":"+48123456789"},"content":{"type":"media","media":{"mediaId":"mda_d7pka1i9v5sfp2ud6chg","caption":"Your invoice is attached.","filename":"invoice-4827.pdf","mimeType":"application/pdf","mediaType":"document"}}}}}}}},"responses":{"202":{"description":"Message accepted for delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"request_dependent","permissions":["message:create","contact:read"],"roles":["owner","admin","agent"],"description":"Send an outbound message. Conversation and channel recipients require message:create in conversation scope; contact recipients also resolve through contact:read."}}},"/messages/{id}":{"get":{"operationId":"getMessage","summary":"Get message","description":"Returns a message with its delivery state and the conversation it belongs to. Use it to\npoll delivery state when you are not using webhooks.\n","security":[{"bearerAuth":["conversation:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Message ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetMessageResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:read"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Read a message through its conversation context."}}},"/media/{mediaId}":{"get":{"operationId":"getMedia","summary":"Get message media","description":"Returns a short-lived download URL for a media file stored by Flownally. Use the\n`content.media.mediaId` of a message or webhook payload, or the `mediaId` of an upload.\n\nStoring inbound media doesn't delay the message, and no `message.updated` event is sent\nwhen the file is ready. The media metadata on the message isn't updated either: once the\nfile is ready, use the `mimeType`, `filename` and `fileSize` in this response.\n\nA response with `ready: false` has no `url`:\n\n- Without `failureCode`, Flownally is still storing the file. Poll again with backoff.\n- With `failureCode`, the media failed permanently and will never become available.\n  Stop polling.\n","security":[{"bearerAuth":["conversation:read"]}],"parameters":[{"name":"mediaId","in":"path","required":true,"description":"Media ID from `content.media.mediaId` or an upload response.","schema":{"type":"string"}}],"responses":{"200":{"description":"Media download URL, when the object is ready.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaDownloadURLResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"static","permissions":["conversation:read"],"roles":["owner","admin","agent"],"description":"Get an authorized download URL for message media."}}},"/media/uploads":{"post":{"operationId":"createMediaUpload","summary":"Upload message media","description":"Uploads a file and returns a `mediaId` to send it with. Pass it as\n`content.media.mediaId` when you send media content. Empty files and HTML, XML or SVG\ncontent return `400` with code `gateway_media_upload_unsupported_type`.\n","x-codeSamples":[{"lang":"cURL","label":"Upload a PDF","source":"curl -X POST \"https://api.flownally.com/v1/media/uploads\" \\\n  -H \"Authorization: Bearer {token}\" \\\n  -F \"file=@invoice-4827.pdf\"\n"}],"security":[{"bearerAuth":["message:create"]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/CreateMediaUploadRequest"}}}},"responses":{"201":{"description":"Media uploaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaUploadResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"static","permissions":["message:create"],"roles":["owner","admin","agent"],"description":"Upload media for a future message send."}}},"/conversations":{"get":{"operationId":"listConversations","summary":"List conversations","description":"Returns the conversations the caller can access, one page at a time. Pass `nextPageToken`\nas `pageToken` to get the next page. Each page is read from a separate snapshot.\n\nEach conversation carries the same `messagingWindow` as `getConversation`, so a reply can\nbe offered or blocked before the detail loads.\n","security":[{"bearerAuth":["conversation:list"]}],"parameters":[{"name":"skipBucketCounts","in":"query","description":"Set to `true` to leave `bucketCounts` out of the response, for example on later pages.\nDefaults to `false`.\n","schema":{"type":"boolean"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","description":"Token returned as `nextPageToken` from the previous page.","schema":{"type":"string"}},{"name":"interacted","in":"query","description":"`true` returns only conversations in which the customer has sent a message; `false`\nreturns only those in which they haven't.\n","schema":{"type":"boolean"}},{"name":"banned","in":"query","description":"`true` returns only conversations whose customer is banned; `false` returns only those\nwhose customer isn't. Omitted returns both. Setting it orders by recent activity, like\n`bucket`. For the main inbox leave it unset: filtering on `false` makes the counts\nslower.\n","schema":{"type":"boolean"}},{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive substring match on the conversation `name` and `externalId`. A phone\nnumber also matches the customer's phone number, ignoring formatting.\n"},{"name":"conversationIds","in":"query","style":"form","explode":true,"schema":{"type":"array","items":{"type":"string"}},"description":"Return only these conversations. Conversations the caller can't access are left out."},{"name":"status","in":"query","description":"Return only conversations with one of these `status` values.","schema":{"type":"array","items":{"type":"string","enum":["cold","pending","open","closed"]}}},{"name":"ownerType","in":"query","description":"Return only conversations whose `activeOwner` has one of these types. `unassigned`\nmatches sessions without an owner. `external` matches conversations a party Flownally\ndoes not run is answering; they match no other type.\n","schema":{"type":"array","items":{"type":"string","enum":["user","chatbot","journey","service_account","inbox","external","unassigned"]}}},{"name":"sort","in":"query","description":"- `status`: pending, then open, cold and closed conversations, each group ordered by\n  the customer's latest message.\n- `recent`: by `lastMessageAt`.\n- `waiting`: by `waitingSince`, followed by conversations that aren't waiting.\n\nWith `bucket` or `mine`, `status` orders like `recent`.\n","schema":{"type":"string","enum":["status","recent","waiting"],"default":"status"}},{"name":"bucket","in":"query","description":"Return only conversations in this bucket:\n\n- `open`: the session is pending or open and assigned to a teammate or unassigned.\n- `automated`: the session isn't closed and is owned by a chatbot, journey, API key or\n  connected inbox. A conversation held by an external responder that Flownally doesn't\n  run, such as Meta's Business Agent on WhatsApp, is `automated` while its session isn't\n  closed, whoever owns the session.\n- `done`: every session is closed, or the conversation has no session.\n","schema":{"type":"string","enum":["open","automated","done"]}},{"name":"mine","in":"query","description":"Return only conversations in the `open` bucket that are assigned to the caller. Works\nonly for a signed-in user; with an API key the request fails with `400`.\n","schema":{"type":"boolean"}},{"name":"orderDirection","in":"query","description":"Direction of the time ordering that `sort` uses.","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"List of conversations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListConversationsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:list"],"roles":["owner","admin","agent"],"scope":"conversation","description":"List conversations in the caller's conversation scope."}}},"/conversations/{id}":{"get":{"operationId":"getConversation","summary":"Get conversation","description":"Returns a conversation with its current status, owner and reply window. On channels that\nallow replies only for a limited time after the customer's last message, such as WhatsApp,\nMessenger and Instagram, `messagingWindow` shows whether that window is open.\n\n`messagingWindow` is calculated for a teammate's reply (`forActor` is `AGENT`). Messages\nsent with an API key follow the `BOT` window, which on Messenger and Instagram lasts 24\nhours after the customer's last message instead of 7 days.\n","security":[{"bearerAuth":["conversation:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Conversation details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:read"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Read a conversation in the caller's conversation scope."}}},"/conversations/{id}/messages":{"get":{"operationId":"listConversationMessages","summary":"List conversation messages","description":"Returns the conversation's messages, newest first (by `createdAt`, then `id`), together\nwith the conversation itself.\n\nPass `sessionId` to list only the messages of one session, including a closed one. The\nsession must belong to this conversation and be accessible to the caller; otherwise the\nrequest returns `404`. With `sessionId`, `conversation` describes that session and its\nlatest message that isn't deleted: `messagingWindow`, `automationOutcome` and\n`actionContext` are omitted and `waitingSince` is `null`. For a session without messages,\n`lastMessageAt` is when the session started and `lastMessagePreview` is empty.\n\nTo get the next page, pass `nextPageToken` as `pageToken` with the same conversation and\n`sessionId`. `pageSize` can change between pages. Each page is read from a separate\nsnapshot, so later pages can reflect updates made after earlier pages were read.\n","security":[{"bearerAuth":["conversation:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}},{"name":"sessionId","in":"query","description":"Return only messages from this session, for example the `sessionId` of a message or\nwebhook. Omit to list all of the conversation's messages.\n","schema":{"type":"string","minLength":1}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","description":"Token returned as `nextPageToken` from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of messages","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListMessagesResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:read"],"roles":["owner","admin","agent"],"scope":"conversation","description":"List messages for a conversation in scope."}},"post":{"operationId":"sendConversationMessage","summary":"Send message in conversation","description":"Sends a message in an existing conversation through the conversation's inbox. `inboxId`\nis optional; if you pass it, it must match the conversation's `inboxId`, or the request\nfails with `400`. The response is `202 Accepted` as soon as Flownally accepts the message,\nso poll `GET /messages/{id}` to follow delivery state when you are not using webhooks.\n\nWhile another responder holds the conversation (shown as `activeOwner` type `external`\nwhile its session is open), anything but a WhatsApp template fails with `422` and code\n`messaging_assignment_held_externally`, and nothing is sent.\n","x-codeSamples":[{"lang":"cURL","label":"Reply with text","source":"curl -X POST \"https://api.flownally.com/v1/conversations/cnv_d7pigoip4tfcdebp5mlg/messages\" \\\n  -H \"Authorization: Bearer {token}\" \\\n  -H \"Idempotency-Key: reply-4827-1\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"content\": {\n      \"type\": \"text\",\n      \"text\": {\n        \"body\": \"Thanks for reaching out. I am checking this now.\"\n      }\n    }\n  }'\n"}],"security":[{"bearerAuth":["message:create"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}},{"$ref":"#/components/parameters/MessageIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"},"examples":{"textReply":{"summary":"Reply with text","value":{"content":{"type":"text","text":{"body":"Thanks for reaching out. I am checking this now."}}}},"mediaReply":{"summary":"Reply with uploaded media","value":{"content":{"type":"media","media":{"mediaId":"mda_d7pka1i9v5sfp2ud6chg","caption":"Your invoice is attached.","filename":"invoice-4827.pdf","mimeType":"application/pdf","mediaType":"document"}}}}}}}},"responses":{"202":{"description":"Message accepted for delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["message:create"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Send a message in a conversation in scope."}}},"/messages/{id}/reactions":{"post":{"operationId":"sendReaction","summary":"Add or remove reaction","description":"Adds the caller's emoji reaction to a message, or removes it when `removed` is `true`. On\nWhatsApp each sender can have one reaction per message, so a new emoji replaces the\nprevious one.\n","security":[{"bearerAuth":["message:create"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"ID of the message to react to.","schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendReactionRequest"}}}},"responses":{"200":{"description":"Reaction sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendReactionResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["message:create"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Add or remove a reaction in an authorized conversation context."}}},"/conversations/{id}:reassign":{"post":{"operationId":"reassignConversation","summary":"Reassign conversation","description":"Assigns the conversation's open session to the teammate in `userId`. Returns `404` when\nthe conversation has no open session.\n","security":[{"bearerAuth":["conversation:assign"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReassignConversationRequest"}}}},"responses":{"204":{"description":"Conversation reassigned"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:assign"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Reassign a conversation in scope."}}},"/conversations/{id}:markRead":{"post":{"operationId":"markReadConversation","summary":"Mark conversation as read","description":"Marks the conversation as read for the caller, up to and including `lastMessageId`, and\nreturns the conversation. `lastMessageId` can be any message in this conversation,\nincoming or outgoing; a message from another conversation returns `400`.\n\nOn channels that support read receipts, Flownally then marks the latest customer message\nup to `lastMessageId` as read for the customer. This happens asynchronously and on a\nbest-effort basis: a successful response confirms the read state in Flownally, not that\nthe customer was notified. A receipt that can't be sent doesn't undo the read state.\n","security":[{"bearerAuth":["conversation:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkConversationReadRequest"}}}},"responses":{"200":{"description":"Conversation marked as read","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:read"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Mark a conversation in scope as read."}}},"/conversations/{id}:close":{"post":{"operationId":"closeConversation","summary":"Close conversation","description":"Closes the conversation's open session and returns the updated conversation. Returns `404`\nwhen the conversation has no open session, and `409` with code\n`messaging_inbox_context_changed` when `expectedContext` no longer matches the conversation.\nA closed session is never reopened: the next message from the customer or a teammate\nstarts a new session in the same conversation.\n\nSessions also close automatically, depending on who owns them:\n\n- Chatbot, API key (`service_account`) or connected inbox (`inbox`): 1 hour after the\n  owner's latest successful reply if the customer hasn't written since; otherwise 7 days\n  after the customer's latest message.\n- Human agent (`user`): 7 days after the latest successful agent reply if the customer\n  hasn't written since. A session waiting for an agent's reply isn't closed automatically.\n- Unassigned: 7 days after the latest successful reply from a teammate or from the\n  WhatsApp Business app on your number if the customer hasn't written since. Replies from\n  chatbots, journeys, campaigns, API keys or connected inboxes don't count, and a session\n  waiting for a teammate's reply isn't closed automatically.\n\nWhile another responder (such as Meta Business Agent) holds a WhatsApp conversation, its\nsession instead closes 24 hours after its latest message, whoever owns it.\n\nA reply counts as successful once its `deliveryStatus` is `sent`, `delivered` or `read`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseConversationRequest"}}}},"security":[{"bearerAuth":["conversation:close"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Conversation closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:close"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Close a conversation in scope."}}},"/conversations/{id}:ban":{"post":{"operationId":"banConversation","summary":"Ban conversation customer","description":"Sets the ban's terms: `expiresAt` and `reason` replace any earlier ones, and omitting them\nmakes the ban permanent without a reason. Returns the updated conversation.\n\nThe ban applies to this conversation's customer identity in this inbox only; the same\nperson on another channel or number isn't banned.\n\nWhile the customer is banned, their messages, reactions, history imports and edits or\ndeletions of earlier messages are discarded without being stored. Content stored before\nthe ban stays. The channel isn't told: on WhatsApp the customer can still write to the\nnumber, and blocking them there is manual. Sending or reacting to the conversation returns\n`422` with code `messaging_customer_banned`; a message accepted earlier, a reply from a\nconnected help-desk app or a send by phone number or channel ID fails with `failureCode`\n`customer_banned`.\n\n`expiresAt` ends the ban at that time and must be in the future\n(`400 messaging_conversation_ban_expiry_invalid`); without it the ban lasts until the\ncustomer is unbanned. Once a ban expires the conversation reads as not banned and messages\nflow again; no conversation change is published at that moment. `reason` is an optional\nnote, trimmed, of at most 500 characters (`400 messaging_conversation_ban_reason_too_long`).\n\nBanning a customer who is already banned keeps the original `bannedAt` and `bannedBy`.\nBanning after a ban expired starts a new ban. Returns `404` when the conversation doesn't\nexist or the caller can't access it.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BanConversationRequest"}}}},"security":[{"bearerAuth":["conversation:ban"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Customer banned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:ban"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Ban the customer of a conversation in scope."}}},"/conversations/{id}:unban":{"post":{"operationId":"unbanConversation","summary":"Unban conversation customer","description":"Lifts the ban on the conversation's customer and returns the updated conversation.\nUnbanning a customer who isn't banned, or whose ban has expired, succeeds and changes\nnothing. Messages the customer\nsent while banned are not recovered. Returns `404` when the conversation doesn't exist or\nthe caller can't access it.\n","security":[{"bearerAuth":["conversation:ban"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Conversation ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Customer unbanned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Messaging"],"x-flownally-authz":{"kind":"scoped","permissions":["conversation:ban"],"roles":["owner","admin","agent"],"scope":"conversation","description":"Unban the customer of a conversation in scope."}}},"/contacts":{"post":{"operationId":"createContact","summary":"Create contact","description":"Creates a customer profile that can be matched to messages and events.","security":[{"bearerAuth":["contact:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactRequest"}}}},"responses":{"201":{"description":"Contact created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["contact:create"],"roles":["owner","admin","agent"],"description":"Create a contact in the workspace."}}},"/contacts:search":{"post":{"operationId":"searchContacts","summary":"Search contacts","description":"Returns a page of contact summaries that match every condition in `query`. This is also how\nyou list contacts: send `{\"query\": {\"match\": \"all\", \"conditions\": []}}` to list them all.\n\nArchived contacts are excluded unless `query` has an `archiveStatus` condition. Use\n`archiveStatus` with `all` to include them, or with `archived` to return only archived\ncontacts. Pass `nextPageToken` as `pageToken` to fetch the next page.\n","security":[{"bearerAuth":["contact:list"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSearchRequest"}}}},"responses":{"200":{"description":"Contacts matching the query","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSearchResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:list"],"roles":["owner","admin","agent"],"scope":"contact","description":"Search contacts in the caller's contact scope."}}},"/contacts:count":{"get":{"operationId":"countContacts","summary":"Count contacts","description":"Returns the number of contacts in the workspace. Search conditions do not apply: `archived`\nselects whether non-archived or archived contacts are counted. It is also a cheap call for\nchecking that an API key is accepted.","security":[{"bearerAuth":["contact:list"]}],"parameters":[{"name":"archived","in":"query","schema":{"type":"boolean"},"description":"Pass `true` to count archived contacts. Omit it or pass `false` to count non-archived\ncontacts."}],"responses":{"200":{"description":"Contact count","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactsCountResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:list"],"roles":["owner","admin","agent"],"scope":"contact","description":"Count contacts in the caller's contact scope."}}},"/contacts/{id}":{"get":{"operationId":"getContact","summary":"Get contact","description":"Returns one customer profile with conversations, tags, custom fields, and archive state.","security":[{"bearerAuth":["contact:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Contact found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:read"],"roles":["owner","admin","agent"],"scope":"contact","description":"Read a contact in the caller's contact scope."}},"patch":{"operationId":"updateContact","summary":"Update contact","description":"Renames a contact. `name` is the only field you can change here, and a body without it is\nrejected with 400. To change a custom field value, use\n`PUT /contacts/{contactId}/custom-fields/{customFieldId}`.\n","security":[{"bearerAuth":["contact:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactRequest"}}}},"responses":{"200":{"description":"Contact updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:update"],"roles":["owner","admin","agent"],"scope":"contact","description":"Update a contact in the caller's contact scope."}},"delete":{"operationId":"deleteContact","summary":"Delete contact","description":"Deletes a contact. Campaign recipient entries for the contact lose `contactId` and the\ncontact snapshot, and entries not yet sent are marked `failed`. To hide a contact without\ndeleting it, archive it instead.\n","security":[{"bearerAuth":["contact:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Contact deleted"},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:delete"],"roles":["owner","admin","agent"],"scope":"contact","description":"Delete a contact in the caller's contact scope."}}},"/contacts:import":{"post":{"operationId":"importContacts","summary":"Import contacts from CSV","description":"Uploads a CSV file and starts a background contact import. Poll the returned import ID\nto review completion counts and row-level errors.\n","security":[{"bearerAuth":["contact:create"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","columnMapping"],"properties":{"file":{"type":"string","format":"binary","description":"CSV file with a header row, up to 5 MB and 100,000 rows. An import of a file with\nmore rows fails without creating any contacts."},"columnMapping":{"type":"string","description":"JSON object that maps CSV column headers to `name`, `phone`, or a custom field\nID, for example `{\"Full name\": \"name\", \"Mobile\": \"phone\", \"City\": \"cf_…\"}`."},"tagIds":{"type":"array","description":"Existing tag IDs to attach to every successfully imported contact. Tags must\nbelong to this workspace.","maxItems":100,"items":{"type":"string","minLength":1}}}}}}},"responses":{"202":{"description":"Import initiated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportContactsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["contact:create"],"roles":["owner","admin","agent"],"description":"Import contacts into the workspace."}}},"/contacts/imports/{id}":{"get":{"operationId":"getImportStatus","summary":"Get import status","description":"Returns progress and row-level failures for a contact import. The status stays `pending`,\nwith zero counts, until the whole file has been processed.\n","security":[{"bearerAuth":["contact:list"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Import ID returned by `POST /contacts:import`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Import status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportStatus"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:list"],"roles":["owner","admin","agent"],"scope":"contact","description":"Read contact import status."}}},"/contacts/{id}:archive":{"post":{"operationId":"archiveContact","summary":"Archive contact","description":"Hides a contact from default searches and counts without deleting its history. A new message\nfrom the customer unarchives the contact automatically.\n","security":[{"bearerAuth":["contact:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Contact archived"},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Contact is already archived","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:update"],"roles":["owner","admin","agent"],"scope":"contact","description":"Archive a contact in the caller's contact scope."}}},"/contacts/{id}:unarchive":{"post":{"operationId":"unarchiveContact","summary":"Unarchive contact","description":"Restores an archived contact to default searches and counts.","security":[{"bearerAuth":["contact:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Contact unarchived"},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Contact is not archived","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:update"],"roles":["owner","admin","agent"],"scope":"contact","description":"Unarchive a contact in the caller's contact scope."}}},"/contacts/{contactId}/custom-fields/{customFieldId}":{"put":{"operationId":"setContactCustomFieldValue","summary":"Set contact field value","description":"Sets or clears one custom field value on a contact. Send an empty string to clear the\nvalue; the field definition is kept. Values for `date` fields use `YYYY-MM-DD`.\n","security":[{"bearerAuth":["contact:update"]}],"parameters":[{"name":"contactId","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}},{"name":"customFieldId","in":"path","required":true,"description":"ID of a contact field definition, for example `cf_d7pgooc1v8t53cs68k5g`.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetContactCustomFieldValueRequest"}}}},"responses":{"204":{"description":"Contact field value set"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:update"],"roles":["owner","admin","agent"],"scope":"contact","description":"Set a custom field value on a contact in scope."}}},"/contacts/{contactId}/tags/{tagId}":{"post":{"operationId":"tagContact","summary":"Add tag to contact","description":"Adds a label to the contact for segmentation, routing, or reporting.","security":[{"bearerAuth":["contact:update"]}],"parameters":[{"name":"contactId","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}},{"name":"tagId","in":"path","required":true,"description":"Tag ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Tag added"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:update"],"roles":["owner","admin","agent"],"scope":"contact","description":"Tag a contact in scope."}},"delete":{"operationId":"untagContact","summary":"Remove tag from contact","description":"Removes a label from the contact.","security":[{"bearerAuth":["contact:update"]}],"parameters":[{"name":"contactId","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}},{"name":"tagId","in":"path","required":true,"description":"Tag ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Tag removed"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["contact:update"],"roles":["owner","admin","agent"],"scope":"contact","description":"Remove a tag from a contact in scope."}}},"/segments":{"get":{"operationId":"listSegments","summary":"List segments","description":"Returns the workspace's saved segments. Member counts are not included; use\n`POST /segments/{segmentId}/contacts:search` to evaluate a segment.\n","security":[{"bearerAuth":["segment:list"]}],"parameters":[{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","description":"The `nextPageToken` from the previous page.","schema":{"type":"string","maxLength":4096}}],"responses":{"200":{"description":"Saved segments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["segment:list"],"roles":["owner","admin","agent"],"description":"List saved contact segments."}},"post":{"operationId":"createSegment","summary":"Create segment","description":"Saves a contact filter as a named segment. The `ETag` response header holds the revision to\nsend in `If-Match` when you update or delete the segment. `searchText` conditions cannot be\nsaved in a segment.\n","security":[{"bearerAuth":["segment:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSegmentRequest"}}}},"responses":{"201":{"description":"Segment created","headers":{"Etag":{"$ref":"#/components/headers/Etag"},"Location":{"description":"Relative URL of the created segment.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["segment:create"],"roles":["owner","admin"],"description":"Create a saved contact segment."}}},"/segments/{segmentId}":{"get":{"operationId":"getSegment","summary":"Get segment","description":"Returns a saved segment. The `ETag` response header holds its current revision.","security":[{"bearerAuth":["segment:read"]}],"parameters":[{"$ref":"#/components/parameters/SegmentID"}],"responses":{"200":{"description":"Saved segment","headers":{"Etag":{"$ref":"#/components/headers/Etag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["segment:read"],"roles":["owner","admin","agent"],"description":"Read a saved contact segment."}},"patch":{"operationId":"updateSegment","summary":"Update segment","description":"Updates the supplied fields and leaves the others unchanged. A supplied `filter` replaces the\nsaved filter as a whole. Send the segment's current `ETag` in `If-Match`.\n","security":[{"bearerAuth":["segment:update"]}],"parameters":[{"$ref":"#/components/parameters/SegmentID"},{"$ref":"#/components/parameters/IfMatch"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSegmentRequest"}}}},"responses":{"200":{"description":"Segment updated","headers":{"Etag":{"$ref":"#/components/headers/Etag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"412":{"description":"The supplied `ETag` is stale (`contacts_segment_revision_mismatch`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"428":{"description":"`If-Match` is missing (`gateway_segment_if_match_required`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["segment:update"],"roles":["owner","admin"],"description":"Update a saved contact segment."}},"delete":{"operationId":"deleteSegment","summary":"Delete segment","description":"Deletes a saved segment. Send the segment's current `ETag` in `If-Match`. A segment used by\na scheduled campaign cannot be deleted; the request returns 422\n`contacts_segment_campaign_in_use`.\n","security":[{"bearerAuth":["segment:delete"]}],"parameters":[{"$ref":"#/components/parameters/SegmentID"},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"204":{"description":"Segment deleted"},"412":{"description":"The supplied `ETag` is stale (`contacts_segment_revision_mismatch`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"428":{"description":"`If-Match` is missing (`gateway_segment_if_match_required`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["segment:delete"],"roles":["owner","admin"],"description":"Delete a saved contact segment."}}},"/segments/{segmentId}/contacts:search":{"post":{"operationId":"searchSegmentContacts","summary":"Search segment contacts","description":"Returns contacts that match both the segment's saved filter and the supplied `query`. Send\nan empty `conditions` array to list every member of the segment.\n\nUnless the saved filter has an `archiveStatus` condition, archived contacts are excluded.\nAn `archiveStatus` condition in `query` can only narrow the result further. `totalSize` may\nbe cached for up to five minutes; `evaluatedAt` reports when it was calculated.\n","security":[{"bearerAuth":["segment:read","contact:list"]}],"parameters":[{"$ref":"#/components/parameters/SegmentID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSearchRequest"}}}},"responses":{"200":{"description":"Current segment members","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSearchResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"scoped","permissions":["segment:read","contact:list"],"roles":["owner","admin","agent"],"scope":"contact","description":"Search contacts matching a saved segment in the caller's contact scope."}}},"/reports":{"get":{"operationId":"listReports","summary":"List reports","description":"Returns the reports you can query, with each report's metrics, the `dimensions` you can\ngroup it by and the `filters` it accepts.\n","security":[{"bearerAuth":["report:read"]}],"responses":{"200":{"description":"Report definitions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportsResponse"}}}},"default":{"$ref":"#/components/responses/Error"}},"tags":["Reports"],"x-flownally-authz":{"kind":"static","permissions":["report:read"],"roles":["owner","admin"],"description":"List report definitions."}}},"/reports/{reportId}/query":{"post":{"operationId":"queryReport","summary":"Query report","description":"Returns one page of a report's rows for a date range, with metric totals for the range and\nfor the same number of days just before it.\n\n- `from` and `to` must each be the start of a day in `timezone`, 1 to 90 days apart.\n- `groupBy` must be one of the report's `dimensions`. Omit it to group by the report's\n  `grain`.\n- Use only the `filters` the report lists.\n- Rows grouped by `day` include every day or week in the range, even ones with no data.\n- For the next page, send the same query with `after` set to `pageInfo.endCursor`.\n\nA query the report doesn't support fails with `400` and code `reporting_invalid_query`.\n","security":[{"bearerAuth":["report:read"]}],"parameters":[{"name":"reportId","in":"path","required":true,"description":"Report ID from `GET /reports`, for example `customer-sessions` or `campaigns`.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportQuery"}}}},"responses":{"200":{"description":"Report result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportResult"}}}},"default":{"$ref":"#/components/responses/Error"}},"tags":["Reports"],"x-flownally-authz":{"kind":"static","permissions":["report:read"],"roles":["owner","admin"],"description":"Query a report."}}},"/campaigns":{"get":{"operationId":"listCampaigns","summary":"List campaigns","description":"Returns the workspace's campaigns. Pass `status` to return only campaigns in that state.\n","security":[{"bearerAuth":["campaign:list"]}],"parameters":[{"name":"status","in":"query","description":"Return only campaigns with this status.","schema":{"$ref":"#/components/schemas/CampaignStatus"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","description":"The `nextPageToken` from the previous page.","schema":{"type":"string","maxLength":4096}}],"responses":{"200":{"description":"Campaigns","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:list"],"roles":["owner","admin","agent"],"description":"List campaigns in the workspace."}},"post":{"operationId":"createCampaign","summary":"Create campaign","description":"Creates a draft campaign with a name. Set its segment, inbox, and content with\n`PATCH /campaigns/{campaignId}`, then schedule it.\n","security":[{"bearerAuth":["campaign:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignRequest"}}}},"responses":{"201":{"description":"Campaign created","headers":{"Etag":{"$ref":"#/components/headers/CampaignsEtag"},"Location":{"description":"Relative URL of the created campaign.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:create"],"roles":["owner","admin"],"description":"Create a draft campaign."}}},"/campaigns/{campaignId}":{"get":{"operationId":"getCampaign","summary":"Get campaign","description":"Returns a campaign. The `ETag` response header holds its current revision.","security":[{"bearerAuth":["campaign:read"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"}],"responses":{"200":{"description":"Campaign","headers":{"Etag":{"$ref":"#/components/headers/CampaignsEtag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:read"],"roles":["owner","admin","agent"],"description":"Read a campaign."}},"patch":{"operationId":"updateCampaign","summary":"Update campaign","description":"Updates the supplied fields of a draft campaign; other campaigns cannot be edited. Send an\nempty string for `segmentId` or `inboxId`, or `null` for `content`, to clear it.\n`If-Match` is optional; when supplied, it must contain the current campaign `ETag`.\n","security":[{"bearerAuth":["campaign:update"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"},{"$ref":"#/components/parameters/CampaignsIfMatch"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignRequest"}}}},"responses":{"200":{"description":"Campaign updated","headers":{"Etag":{"$ref":"#/components/headers/CampaignsEtag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"412":{"description":"The supplied ETag is stale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:update"],"roles":["owner","admin"],"description":"Update a draft campaign."}},"delete":{"operationId":"deleteCampaign","summary":"Delete campaign","description":"Deletes a draft or sent campaign. Unschedule a scheduled campaign before deleting it.\n`If-Match` is optional.\n","security":[{"bearerAuth":["campaign:delete"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"},{"$ref":"#/components/parameters/CampaignsIfMatch"}],"responses":{"204":{"description":"Campaign deleted"},"412":{"description":"The supplied ETag is stale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:delete"],"roles":["owner","admin"],"description":"Delete a draft or sent campaign."}}},"/campaigns/{campaignId}:schedule":{"post":{"operationId":"scheduleCampaign","summary":"Schedule campaign","description":"Schedules a draft campaign. Set `sendAt` to `now` to send immediately, or to a future\nRFC 3339 timestamp. The campaign needs a `segmentId`, `inboxId`, and `content` first.\n`If-Match` is optional.\n\nA segment larger than the inbox's WhatsApp account can still reach in 24 hours is refused\nwith 422 `contacts_campaign_messaging_limit_exceeded`. Dispatch checks the final audience\nagain and returns the campaign to draft with `dispatchError` when it no longer fits.\n","security":[{"bearerAuth":["campaign:schedule"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"},{"$ref":"#/components/parameters/CampaignsIfMatch"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleCampaignRequest"}}}},"responses":{"200":{"description":"Campaign scheduled","headers":{"Etag":{"$ref":"#/components/headers/CampaignsEtag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"412":{"description":"The supplied ETag is stale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:schedule"],"roles":["owner","admin"],"description":"Schedule a draft campaign."}}},"/campaigns/{campaignId}:unschedule":{"post":{"operationId":"unscheduleCampaign","summary":"Unschedule campaign","description":"Returns a scheduled campaign to draft. A campaign cannot be unscheduled after dispatch\nstarts. `If-Match` is optional.\n","security":[{"bearerAuth":["campaign:schedule"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"},{"$ref":"#/components/parameters/CampaignsIfMatch"},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Campaign returned to draft","headers":{"Etag":{"$ref":"#/components/headers/CampaignsEtag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"412":{"description":"The supplied ETag is stale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:schedule"],"roles":["owner","admin"],"description":"Return a scheduled campaign to draft."}}},"/campaigns/{campaignId}/recipients":{"get":{"operationId":"listCampaignRecipients","summary":"List campaign recipients","description":"Returns the recipients in a campaign's final audience with their delivery status. The list\nis empty until the campaign is sent.\n","security":[{"bearerAuth":["campaign:recipients","contact:list"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"},{"name":"status","in":"query","description":"Return only recipients with this status.","schema":{"$ref":"#/components/schemas/CampaignRecipientStatus"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","description":"The `nextPageToken` from the previous page.","schema":{"type":"string","maxLength":4096}}],"responses":{"200":{"description":"Campaign recipients","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRecipientsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:recipients","contact:list"],"roles":["owner","admin"],"description":"List campaign recipients."}}},"/campaigns/{campaignId}/analytics":{"get":{"operationId":"getCampaignAnalytics","summary":"Get campaign analytics","description":"Returns recipient counts by delivery status, plus delivery and read rates.","security":[{"bearerAuth":["campaign:read"]}],"parameters":[{"$ref":"#/components/parameters/CampaignID"}],"responses":{"200":{"description":"Campaign analytics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignAnalytics"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["campaign:read"],"roles":["owner","admin","agent"],"description":"Read campaign delivery analytics."}}},"/tags":{"get":{"operationId":"listTags","summary":"List tags","description":"Returns the labels available for organizing contacts, newest first.","security":[{"bearerAuth":["tag:list"]}],"responses":{"200":{"description":"List of tags","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["tag:list"],"roles":["owner","admin","agent"],"description":"List contact tags in the workspace."}},"post":{"operationId":"createTag","summary":"Create tag","description":"Creates a label that can be attached to contacts.","security":[{"bearerAuth":["tag:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTagRequest"}}}},"responses":{"201":{"description":"Tag created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tag"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["tag:create"],"roles":["owner","admin","agent"],"description":"Create a contact tag in the workspace."}}},"/tags/{id}":{"delete":{"operationId":"deleteTag","summary":"Delete tag","description":"Deletes a tag. A tag used in a saved segment cannot be deleted; the request returns 422\n`contacts_segment_dependency_in_use`.\n","security":[{"bearerAuth":["tag:delete","segment:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Tag ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Tag deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["tag:delete","segment:update"],"roles":["owner","admin"],"description":"Delete a contact tag and update any referencing segments."}}},"/contacts/custom-fields":{"get":{"operationId":"listContactFieldDefinitions","summary":"List contact field definitions","description":"Returns the reusable custom fields that can store structured customer context on\ncontacts, such as lifecycle stage, preferred store, or renewal date.\n","security":[{"bearerAuth":["custom_field:list"]}],"responses":{"200":{"description":"Contact field definitions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionsResponse"},"examples":{"contactFieldDefinitions":{"summary":"Contact field definitions","value":{"customFields":[{"id":"cf_d7pgooc1v8t53cs68k5g","name":"Lifecycle stage","type":"text","createdAt":"2026-04-30T09:00:00Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","predefined":false,"entityType":"contact"}]}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:list"],"roles":["owner","admin","agent"],"description":"List contact field definitions."}},"post":{"operationId":"createContactFieldDefinition","summary":"Create contact field definition","description":"Creates a reusable custom field for storing customer context on contacts.","security":[{"bearerAuth":["custom_field:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomFieldDefinitionRequest"},"examples":{"lifecycleStage":{"summary":"Lifecycle stage","value":{"name":"Lifecycle stage","type":"text"}}}}}},"responses":{"201":{"description":"Contact field definition created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinition"},"examples":{"contactFieldDefinition":{"summary":"Contact field definition","value":{"id":"cf_d7pgooc1v8t53cs68k5g","name":"Lifecycle stage","type":"text","createdAt":"2026-04-30T09:00:00Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","predefined":false,"entityType":"contact"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:create"],"roles":["owner","admin","agent"],"description":"Create a contact field definition."}}},"/contacts/custom-fields/{id}":{"patch":{"operationId":"updateContactFieldDefinition","summary":"Update contact field definition","description":"Renames a contact field definition.","security":[{"bearerAuth":["custom_field:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Custom field ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomFieldDefinitionRequest"}}}},"responses":{"200":{"description":"Contact field definition updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinition"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:update"],"roles":["owner","admin","agent"],"description":"Update a contact field definition."}},"delete":{"operationId":"deleteContactFieldDefinition","summary":"Delete contact field definition","description":"Deletes a contact field definition that is no longer needed. Predefined fields cannot be\ndeleted (403). A field used in a saved segment cannot be deleted; the request returns 422\n`contacts_segment_dependency_in_use`.\n","security":[{"bearerAuth":["custom_field:delete","segment:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Custom field ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Contact field definition deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:delete","segment:update"],"roles":["owner","admin"],"description":"Delete a contact field definition and update any referencing segments."}}},"/properties/custom-fields":{"get":{"operationId":"listPropertyFieldDefinitions","summary":"List property field definitions","description":"Returns the reusable custom fields that can store structured context on property\nrecords, such as region, tier, or renewal date.\n","security":[{"bearerAuth":["custom_field:list"]}],"responses":{"200":{"description":"Property field definitions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionsResponse"},"examples":{"propertyFieldDefinitions":{"summary":"Property field definitions","value":{"customFields":[{"id":"cf_d7pk58tlq90js01eokv0","name":"Region","type":"text","createdAt":"2026-04-30T09:00:00Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","predefined":false,"entityType":"property"}]}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:list"],"roles":["owner","admin","agent"],"description":"List property field definitions."}},"post":{"operationId":"createPropertyFieldDefinition","summary":"Create property field definition","description":"Creates a reusable custom field for storing context on property records.","security":[{"bearerAuth":["custom_field:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomFieldDefinitionRequest"},"examples":{"region":{"summary":"Region","value":{"name":"Region","type":"text"}}}}}},"responses":{"201":{"description":"Property field definition created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinition"},"examples":{"propertyFieldDefinition":{"summary":"Property field definition","value":{"id":"cf_d7pk58tlq90js01eokv0","name":"Region","type":"text","createdAt":"2026-04-30T09:00:00Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","predefined":false,"entityType":"property"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:create"],"roles":["owner","admin","agent"],"description":"Create a property field definition."}}},"/properties/custom-fields/{id}":{"patch":{"operationId":"updatePropertyFieldDefinition","summary":"Update property field definition","description":"Renames a property field definition.","security":[{"bearerAuth":["custom_field:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Custom field ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomFieldDefinitionRequest"}}}},"responses":{"200":{"description":"Property field definition updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinition"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:update"],"roles":["owner","admin","agent"],"description":"Update a property field definition."}},"delete":{"operationId":"deletePropertyFieldDefinition","summary":"Delete property field definition","description":"Deletes a property field definition that is no longer needed.","security":[{"bearerAuth":["custom_field:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Custom field ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Property field definition deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Contacts"],"x-flownally-authz":{"kind":"static","permissions":["custom_field:delete"],"roles":["owner","admin","agent"],"description":"Delete a property field definition."}}},"/journeys":{"get":{"operationId":"listJourneys","summary":"List journeys","description":"Returns the workspace's journeys, newest first.","security":[{"bearerAuth":["journey:list"]}],"parameters":[{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of journeys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneysResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:list"],"roles":["owner","admin","agent"],"description":"List journeys in the workspace."}},"post":{"operationId":"createJourney","summary":"Create journey","description":"Creates a journey draft. Publish and activate it before contacts can enter.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateJourneyRequest"}}}},"responses":{"201":{"description":"Journey created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Journey"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"request_dependent","permissions":["journey:create","journey:use_secrets"],"roles":["owner","admin","agent"],"description":"Create a journey in the workspace. A definition whose HTTP requests send workspace secrets also requires journey:use_secrets."}}},"/journeys/{id}":{"get":{"operationId":"getJourney","summary":"Get journey","description":"Returns a journey with its draft, its status and, while it is active, the active version.","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Journey details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Journey"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"Read a journey in the workspace."}},"patch":{"operationId":"updateJourney","summary":"Update journey","description":"Updates a journey's draft. A new `name` applies at once. Changes to `definition`,\n`triggerConfig` and `entryMode` reach contacts only after you publish and activate the\njourney again.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateJourneyRequest"}}}},"responses":{"200":{"description":"Journey updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Journey"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"request_dependent","permissions":["journey:update","journey:use_secrets"],"roles":["owner","admin","agent"],"description":"Update a journey in the workspace. A definition whose HTTP requests send workspace secrets also requires journey:use_secrets."}},"delete":{"operationId":"deleteJourney","summary":"Delete journey","description":"Deletes a journey. Pause an active journey first: deleting it fails with `422` and code\n`contacts_journey_cannot_delete_active`.\n","security":[{"bearerAuth":["journey:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Journey deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:delete"],"roles":["owner","admin","agent"],"description":"Delete a journey in the workspace."}}},"/journeys/{id}:publish":{"post":{"operationId":"publishJourney","summary":"Publish journey","description":"Validates the draft and saves it as a new read-only version. When the draft hasn't\nchanged since the latest version, returns that version instead of creating a copy.\n\nPublishing doesn't change what runs: activate the journey to use the new version. An\ninvalid draft fails with `400`, and `detail` says what to fix.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Version published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyVersion"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"request_dependent","permissions":["journey:publish","journey:use_secrets"],"roles":["owner","admin","agent"],"description":"Publish a journey version. A draft whose HTTP requests send workspace secrets also requires journey:use_secrets."}}},"/journeys/{id}:activate":{"post":{"operationId":"activateJourney","summary":"Activate journey","description":"Makes the latest published version active, so matching triggers start runs for contacts.\nOn an active journey, the latest version replaces the active one for new runs; runs\nalready in progress continue on their version.\n\nFails with `422` and code `contacts_journey_no_published_version` until the journey is\npublished.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Journey activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Journey"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"request_dependent","permissions":["journey:activate","journey:use_secrets"],"roles":["owner","admin","agent"],"description":"Activate a journey. A version whose HTTP requests send workspace secrets also requires journey:use_secrets."}}},"/journeys/{id}:pause":{"post":{"operationId":"pauseJourney","summary":"Pause journey","description":"Pauses an active journey: no new runs start, and runs already in progress continue to the\nend. Activate the journey again to resume.\n\nFails with `422` and code `contacts_journey_not_active` when the journey isn't active.\n","security":[{"bearerAuth":["journey:activate"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Journey paused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Journey"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:activate"],"roles":["owner","admin","agent"],"description":"Pause a journey."}}},"/journeys/{id}/versions":{"get":{"operationId":"listJourneyVersions","summary":"List journey versions","description":"Returns a journey's published versions, newest first.","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of versions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyVersionsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"List journey versions."}}},"/journeys/versions/{versionId}":{"get":{"operationId":"getJourneyVersion","summary":"Get journey version","description":"Returns a published journey version.","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"versionId","in":"path","required":true,"description":"Journey version ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Version details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyVersion"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"Read a journey version."}}},"/journeys/{id}/stats":{"get":{"operationId":"getJourneyStats","summary":"Get journey node counts","description":"Counts where a journey's runs went: how many times runs reached each node, are\non it now, completed or failed on it, and left it by each edge. Every count\nexcept `runningNow` covers runs that entered in the requested range, including\nruns of contacts deleted since.\n\nA query that takes too long fails with `504` and code\n`contacts_journey_query_too_slow`; choose a shorter range.\n","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}},{"name":"versionId","in":"query","description":"Count only runs of this version. Omit to count every version.","schema":{"type":"string"}},{"name":"enteredFrom","in":"query","required":true,"description":"Start of the entry range, inclusive.","schema":{"type":"string","format":"date-time"}},{"name":"enteredTo","in":"query","required":true,"description":"End of the entry range, exclusive. At most 366 days after `enteredFrom`.","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Journey node counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyStats"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"Read where a journey's runs are and which edges they took."}}},"/journeys/{id}/runs":{"get":{"operationId":"listJourneyRuns","summary":"List journey runs","description":"Returns a journey's runs of contacts that still exist, newest first.\n\nA query that takes too long fails with `504` and code\n`contacts_journey_query_too_slow`; narrow it with `enteredFrom` and `enteredTo`.\n","security":[{"bearerAuth":["journey:read","contact:list"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Journey ID.","schema":{"type":"string"}},{"name":"versionId","in":"query","description":"Only runs of this version.","schema":{"type":"string"}},{"name":"currentNodeId","in":"query","description":"Only runs on this node now, or that completed or failed on it.","schema":{"type":"string"}},{"name":"status","in":"query","description":"Only runs with this status.","schema":{"$ref":"#/components/schemas/JourneyRunStatus"}},{"name":"enteredFrom","in":"query","description":"Only runs that entered at or after this time.","schema":{"type":"string","format":"date-time"}},{"name":"enteredTo","in":"query","description":"Only runs that entered before this time. Must be after `enteredFrom`.","schema":{"type":"string","format":"date-time"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string","maxLength":4096}}],"responses":{"200":{"description":"Journey runs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyRunsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Journeys"],"x-flownally-authz":{"kind":"static","permissions":["journey:read","contact:list"],"roles":["owner","admin","agent"],"description":"List a journey's runs with their contacts."}}},"/chatbots":{"get":{"operationId":"listChatbots","summary":"List chatbots","description":"Returns the workspace's chatbots, newest first.","security":[{"bearerAuth":["journey:list"]}],"parameters":[{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of chatbots","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatbotsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:list"],"roles":["owner","admin","agent"],"description":"List chatbots in the workspace."}},"post":{"operationId":"createChatbot","summary":"Create chatbot","description":"Creates a chatbot draft. Publish and activate it before it serves conversations.","security":[{"bearerAuth":["journey:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChatbotRequest"}}}},"responses":{"201":{"description":"Chatbot created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chatbot"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:create"],"roles":["owner","admin","agent"],"description":"Create a chatbot in the workspace."}}},"/chatbots/{id}":{"get":{"operationId":"getChatbot","summary":"Get chatbot","description":"Returns a chatbot with its draft, its status and, while it is active, the active version.","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Chatbot details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chatbot"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"Read a chatbot in the workspace."}},"patch":{"operationId":"updateChatbot","summary":"Update chatbot","description":"Updates a chatbot's name, teams or draft. A new `name` or `teamIds` applies at once.\nChanges to `draft` reach conversations only after you publish and activate the chatbot\nagain.\n\nChanging the teams of an active chatbot fails with `422` and code\n`messaging_chatbot_route_conflict` when another active chatbot already serves one of the\nnew teams, or, when no teams remain, the whole workspace.\n","security":[{"bearerAuth":["journey:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateChatbotRequest"}}}},"responses":{"200":{"description":"Chatbot updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chatbot"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:update"],"roles":["owner","admin","agent"],"description":"Update a chatbot in the workspace."}},"delete":{"operationId":"deleteChatbot","summary":"Delete chatbot","description":"Deletes a chatbot. Pause an active chatbot before you delete it.","security":[{"bearerAuth":["journey:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Chatbot deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:delete"],"roles":["owner","admin","agent"],"description":"Delete a chatbot in the workspace."}}},"/chatbots/{id}:publish":{"post":{"operationId":"publishChatbot","summary":"Publish chatbot","description":"Validates the draft and saves it as a new read-only version. Every call creates a new\nversion, even when the draft hasn't changed.\n\nPublishing doesn't change what runs: activate the chatbot to use the new version. An\ninvalid draft fails with `400`, and `detail` says what to fix.\nA draft with a Meta AI block (`hand_over_to_meta_ai`) fails with `422` and code\n`messaging_chatbot_block_not_enabled` unless the block is enabled for the workspace.\n","security":[{"bearerAuth":["journey:publish"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Version published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatbotVersion"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:publish"],"roles":["owner","admin","agent"],"description":"Publish a chatbot version."}}},"/chatbots/{id}:activate":{"post":{"operationId":"activateChatbot","summary":"Activate chatbot","description":"Makes the latest published version active, so the chatbot serves its teams, or the whole\nworkspace when it has no teams. On an active chatbot, the latest version replaces the\nactive one.\n\n- Fails with `422` and code `messaging_chatbot_route_conflict` while another active\n  chatbot already serves one of its teams or, for a chatbot without teams, the whole\n  workspace. Pause that chatbot first.\n- Fails with `422` and code `messaging_chatbot_no_published_version` until the chatbot is\n  published.\n- Fails with `422` and code `messaging_chatbot_block_not_enabled` when the version has a\n  Meta AI block (`hand_over_to_meta_ai`) that is not enabled for the workspace.\n","security":[{"bearerAuth":["journey:activate"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Chatbot activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chatbot"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:activate"],"roles":["owner","admin","agent"],"description":"Activate a chatbot."}}},"/chatbots/{id}:pause":{"post":{"operationId":"pauseChatbot","summary":"Pause chatbot","description":"Pauses an active chatbot, so another chatbot can be activated for its teams or the whole\nworkspace. Activate the chatbot again to resume.\n\nFails with `422` and code `messaging_chatbot_not_active` when the chatbot isn't active.\n","security":[{"bearerAuth":["journey:activate"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Chatbot paused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chatbot"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:activate"],"roles":["owner","admin","agent"],"description":"Pause a chatbot."}}},"/chatbots/{id}/versions":{"get":{"operationId":"listChatbotVersions","summary":"List chatbot versions","description":"Returns a chatbot's published versions, newest first.","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of versions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatbotVersionsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"List chatbot versions."}}},"/chatbots/{id}/versions/{versionId}":{"get":{"operationId":"getChatbotVersion","summary":"Get chatbot version","description":"Returns a published version of a chatbot.","security":[{"bearerAuth":["journey:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Chatbot ID.","schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"description":"Chatbot version ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Version details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatbotVersion"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Chatbots"],"x-flownally-authz":{"kind":"static","permissions":["journey:read"],"roles":["owner","admin","agent"],"description":"Read a chatbot version."}}},"/event-types":{"get":{"operationId":"listEventTypes","summary":"List event types","description":"Returns the predefined and custom event types you can record for contacts, newest first.","security":[{"bearerAuth":["event_type:list"]}],"parameters":[{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of event types","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventTypesResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event_type:list"],"roles":["owner","admin","agent"],"description":"List event types in the workspace."}},"post":{"operationId":"createEventType","summary":"Create event type","description":"Creates a custom event type. With a `payloadSchema`, the payload of every event recorded\nwith this type must match it. A name the workspace already uses fails with `409`.\n","security":[{"bearerAuth":["event_type:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventTypeRequest"}}}},"responses":{"201":{"description":"Event type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventType"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event_type:create"],"roles":["owner","admin","agent"],"description":"Create an event type in the workspace."}}},"/event-types/{id}":{"get":{"operationId":"getEventType","summary":"Get event type","security":[{"bearerAuth":["event_type:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Event type ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Event type details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventType"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event_type:read"],"roles":["owner","admin","agent"],"description":"Read an event type in the workspace."}},"patch":{"operationId":"updateEventType","summary":"Update event type","description":"Updates a custom event type. A new `payloadSchema` must keep every field of the current\none: you can add fields, but removing one fails with `400`.\n","security":[{"bearerAuth":["event_type:update"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Event type ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEventTypeRequest"}}}},"responses":{"200":{"description":"Event type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventType"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event_type:update"],"roles":["owner","admin","agent"],"description":"Update an event type in the workspace."}},"delete":{"operationId":"deleteEventType","summary":"Delete event type","description":"Deletes a custom event type. Predefined event types can't be deleted, and an event type\nwith recorded events fails with `409`.\n","security":[{"bearerAuth":["event_type:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Event type ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Event type deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event_type:delete"],"roles":["owner","admin","agent"],"description":"Delete an event type in the workspace."}}},"/events":{"get":{"operationId":"listEvents","summary":"List events","description":"Returns the events recorded in the workspace, newest first.","security":[{"bearerAuth":["event:list"]}],"parameters":[{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}},{"name":"eventTypeId","in":"query","description":"Only events of this event type.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of events","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event:list"],"roles":["owner","admin","agent"],"description":"List events in the workspace."}},"post":{"operationId":"createEvent","summary":"Create event","description":"Records an event for the contact in `contactId`. Deprecated: use\n`POST /contacts/{contactId}/events`, which behaves the same.\n","deprecated":true,"security":[{"bearerAuth":["event:create"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventRequest"}}}},"responses":{"201":{"description":"Event created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"409":{"description":"Event with this idempotency key already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event:create"],"roles":["owner","admin","agent"],"description":"Create an event in the workspace."}}},"/events/{id}":{"get":{"operationId":"getEvent","summary":"Get event","description":"Returns a recorded event.","security":[{"bearerAuth":["event:read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Event ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"Event details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event:read"],"roles":["owner","admin","agent"],"description":"Read an event in the workspace."}}},"/contacts/{contactId}/events":{"get":{"operationId":"listContactEvents","summary":"List contact events","description":"Returns the events recorded for a contact, newest first.","security":[{"bearerAuth":["event:list"]}],"parameters":[{"name":"contactId","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","schema":{"type":"string"}},{"name":"eventTypeId","in":"query","description":"Only events of this event type.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of events","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event:list"],"roles":["owner","admin","agent"],"description":"List events for a contact."}},"post":{"operationId":"createContactEvent","summary":"Create contact event","description":"Records an event for the contact, such as a purchase, signup or plan change. `name` is the\nname of a custom or predefined event type. Once the event is recorded, active journeys whose\ntrigger matches it can start a run for the contact, and the contact's runs waiting for this\nevent type continue.\n\n- Fails with `404` when the contact or the event type doesn't exist.\n- Fails with `400` when the payload doesn't match the event type's `payloadSchema`.\n- Fails with `409` when the workspace already has an event with this idempotency key.\n","security":[{"bearerAuth":["event:create"]}],"parameters":[{"name":"contactId","in":"path","required":true,"description":"Contact ID.","schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactEventRequest"}}}},"responses":{"201":{"description":"Event created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"409":{"description":"Event with this idempotency key already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Events"],"x-flownally-authz":{"kind":"static","permissions":["event:create"],"roles":["owner","admin","agent"],"description":"Create an event for a contact."}}},"/billing/status":{"get":{"operationId":"getBillingStatus","summary":"Get billing status","description":"Returns subscription state for the workspace, including access and payment issue flags, what the subscription charges, and how a workspace without one can buy a plan.","security":[{"bearerAuth":["billing:read"]}],"responses":{"200":{"description":"Billing status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingStatusResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["Billing"],"x-flownally-authz":{"kind":"static","permissions":["billing:read"],"roles":["owner","admin"],"description":"Read billing status for the workspace."}}},"/service-accounts":{"get":{"operationId":"listServiceAccounts","summary":"List service accounts","description":"Returns the workspace's service accounts. Each API key belongs to one service account.","security":[{"bearerAuth":["api_key:list"]}],"responses":{"200":{"description":"List of service accounts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListServiceAccountsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["API Keys"],"x-flownally-authz":{"kind":"static","permissions":["api_key:list"],"roles":["owner","admin"],"description":"List service accounts."}},"post":{"operationId":"createServiceAccount","summary":"Create service account","description":"Creates a service account for an integration. Create its API keys with `POST /service-accounts/{id}/api-keys`. Only Owners can create service accounts.","security":[{"bearerAuth":["api_key:create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateServiceAccountRequest"}}}},"responses":{"200":{"description":"Service account created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceAccount"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["API Keys"],"x-flownally-authz":{"kind":"static","permissions":["api_key:create"],"roles":["owner"],"description":"Create a service account."}}},"/service-accounts/{id}":{"delete":{"operationId":"deleteServiceAccount","summary":"Delete service account","description":"Deletes a service account and revokes all of its API keys.","security":[{"bearerAuth":["api_key:revoke"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Service account ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"Service account deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["API Keys"],"x-flownally-authz":{"kind":"static","permissions":["api_key:revoke"],"roles":["owner","admin"],"description":"Delete a service account."}}},"/service-accounts/{id}/api-keys":{"get":{"operationId":"listAPIKeys","summary":"List API keys for a service account","description":"Returns metadata for the service account's API keys. Plaintext keys are never returned.","security":[{"bearerAuth":["api_key:list"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Service account ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of API keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListAPIKeysResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["API Keys"],"x-flownally-authz":{"kind":"static","permissions":["api_key:list"],"roles":["owner","admin"],"description":"List API keys."}},"post":{"operationId":"createAPIKey","summary":"Create API key","description":"Creates an API key for the service account. Only Owners can create API keys, because a key has full access to the workspace. The plaintext key is in the response's `key` field and is shown only once, so store it in a secret manager right away.","security":[{"bearerAuth":["api_key:create"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Service account ID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAPIKeyRequest"}}}},"responses":{"200":{"description":"API key created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAPIKeyResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["API Keys"],"x-flownally-authz":{"kind":"static","permissions":["api_key:create"],"roles":["owner"],"description":"Create an API key."}}},"/api-keys/{id}":{"delete":{"operationId":"revokeAPIKey","summary":"Revoke API key","description":"Revokes an API key. Requests that use it get `403` with code `auth_apikey_revoked`.","security":[{"bearerAuth":["api_key:revoke"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"API key ID.","schema":{"type":"string"}}],"responses":{"204":{"description":"API key revoked"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"tags":["API Keys"],"x-flownally-authz":{"kind":"static","permissions":["api_key:revoke"],"roles":["owner","admin"],"description":"Revoke an API key."}}},"/webhooks":{"get":{"tags":["Webhooks"],"operationId":"getWebhookSettings","summary":"Get webhook settings","description":"Returns the workspace's webhook settings, including the selected event types and the event types you can subscribe to.","security":[{"bearerAuth":["webhook:read"]}],"responses":{"200":{"description":"Webhook settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSettings"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:read"],"roles":["owner","admin"],"description":"Read webhook settings."}},"patch":{"tags":["Webhooks"],"operationId":"updateWebhookSettings","summary":"Update webhook settings","description":"Updates the workspace's webhook settings. Send only the fields you want to change, and\nchoose `eventTypes` from `availableEventTypes`. Changing `url` clears `verified`; deliveries\nresume after `POST /webhooks:verify` succeeds for the new URL.\n","security":[{"bearerAuth":["webhook:update"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookSettingsRequest"}}}},"responses":{"200":{"description":"Updated webhook settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSettings"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:update"],"roles":["owner","admin"],"description":"Update webhook settings."}},"delete":{"tags":["Webhooks"],"operationId":"deleteWebhookSettings","summary":"Delete webhook settings","description":"Removes the workspace's webhook settings and stops deliveries. Delivery attempts stay listed in `GET /webhooks/attempts` until they are 7 days old.","security":[{"bearerAuth":["webhook:delete"]}],"responses":{"204":{"description":"Webhook settings deleted"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:delete"],"roles":["owner","admin"],"description":"Delete webhook settings."}}},"/webhooks:verify":{"post":{"tags":["Webhooks"],"operationId":"verifyWebhook","summary":"Verify webhook delivery","description":"Sends a signed `webhook.test` event to `url`, or to the saved webhook URL when `url` is\nomitted. A `2xx` response from the saved URL marks the webhook `verified`, which deliveries\nrequire.\n","security":[{"bearerAuth":["webhook:update"]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyWebhookRequest"}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyWebhookResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:update"],"roles":["owner","admin"],"description":"Verify webhook delivery."}}},"/webhooks/attempts":{"get":{"tags":["Webhooks"],"operationId":"listWebhookAttempts","summary":"List webhook delivery attempts","description":"Returns webhook delivery attempts from the last 7 days, newest first. Use it to debug deliveries; it isn't a long-term audit log.","security":[{"bearerAuth":["webhook:read"]}],"parameters":[{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","format":"int32","minimum":0,"default":50},"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},{"name":"pageToken","in":"query","required":false,"schema":{"type":"string"}},{"name":"eventType","in":"query","required":false,"schema":{"$ref":"#/components/schemas/WebhookEventName"}},{"name":"status","in":"query","required":false,"schema":{"$ref":"#/components/schemas/WebhookAttemptStatus"}}],"responses":{"200":{"description":"Webhook delivery attempts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWebhookAttemptsResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:read"],"roles":["owner","admin"],"description":"List webhook delivery attempts."}}},"/webhooks/signing-keys":{"get":{"tags":["Webhooks"],"operationId":"listWebhookSigningKeys","summary":"List webhook signing keys","description":"Returns the workspace's active signing key and, during a rotation, the expiring one.\nThe first call in a workspace creates the signing key and returns it once in\n`plaintextKey`. Later calls return metadata only.\n","security":[{"bearerAuth":["webhook:read"]}],"responses":{"200":{"description":"Signing keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWebhookSigningKeysResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:read"],"roles":["owner","admin"],"description":"List webhook signing keys."}}},"/webhooks/signing-keys:rotate":{"post":{"tags":["Webhooks"],"operationId":"rotateWebhookSigningKey","summary":"Rotate webhook signing key","description":"Creates a new signing key and returns it once in `plaintextKey`. The previous key becomes\n`expiring` and keeps signing deliveries for 24 hours, so each delivery carries a signature\nfrom both keys. Update your receiver to the new key within that window.\n","security":[{"bearerAuth":["webhook:update"]}],"responses":{"200":{"description":"New signing key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateWebhookSigningKeyResponse"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"x-flownally-authz":{"kind":"static","permissions":["webhook:update"],"roles":["owner","admin"],"description":"Rotate a webhook signing key."}}}},"webhooks":{"webhookEvent":{"post":{"tags":["Webhooks"],"operationId":"receiveWebhookEvent","summary":"Webhook payloads","description":"The request Flownally sends to your webhook endpoint. Return any `2xx` status after you\naccept an event.\n\n- Delivery is at least once. Deduplicate on the `webhook-id` header, which equals the\n  payload `id` and stays the same on every retry of an event. The body is identical on\n  every retry.\n- Delivery order isn't guaranteed, even within one conversation. For `message.updated`,\n  keep the snapshot with the highest `message.revision`.\n- Each attempt times out after 15 seconds. Any 2xx response acknowledges the event.\n  Redirects aren't followed.\n- Timeouts, connection errors, 3xx, 408, 429 and 5xx responses are retried about\n  30 seconds, 5 minutes and 30 minutes after the first attempt, for 4 attempts in total.\n  Retry times include up to 20% random jitter, and the last retry happens within\n  30 minutes of the first attempt.\n- After a 429, a `Retry-After` value in seconds makes the next attempt wait at least that\n  long. If that is later than 30 minutes after the first attempt, the event isn't retried.\n- 410 and any other 4xx response stop retries for that event.\n- An event that isn't delivered after its last attempt isn't sent again. Flownally never\n  disables the endpoint automatically.\n- `webhook-timestamp` and `webhook-signature` are generated again for each attempt.\n- `GET /webhooks/attempts` lists delivery attempts from the last 7 days.\n- Events are delivered only while the webhook is enabled and verified. Changing `url`\n  clears `verified`; deliveries resume after `POST /webhooks:verify` succeeds for the\n  saved URL. Events from the time in between aren't delivered later.\n","security":[{"standardWebhooks":[]}],"parameters":[{"name":"Webhook-Id","in":"header","required":true,"description":"Event identifier. Equals the payload `id` and stays the same on every retry of the event. Deduplicate deliveries with this value.","schema":{"type":"string"}},{"name":"Webhook-Timestamp","in":"header","required":true,"description":"Unix timestamp in seconds for this delivery attempt; it changes on each retry. Reject stale timestamps to prevent replay.","schema":{"type":"integer","format":"int64"}},{"name":"Webhook-Signature","in":"header","required":true,"description":"Standard Webhooks signature header, generated for each attempt. Verify it against `webhook-id`, `webhook-timestamp`, and the exact raw request body.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"}}}},"responses":{"2XX":{"description":"Event accepted"}},"x-flownally-authz":{"kind":"exempt","permissions":[],"roles":[],"description":"External receiver endpoint shape for webhook events."}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"Service account API key, sent as `Authorization: Bearer flw_…`. Use it only from server-side code."},"standardWebhooks":{"type":"apiKey","in":"header","name":"Webhook-Signature","description":"Standard Webhooks signature, one or more space-separated `v1,<base64>` values. Each is an HMAC-SHA256 of `webhook-id.webhook-timestamp.body` keyed with the workspace's webhook signing key. Reject stale timestamps."}},"schemas":{"InboxesResponse":{"type":"object","description":"Inboxes in the workspace.","required":["inboxes"],"properties":{"inboxes":{"type":"array","items":{"$ref":"#/components/schemas/Inbox"}}},"example":{"inboxes":[{"id":"ibx_d7pi2efp0k7nba4e1mt0","createdAt":"2026-04-30T09:00:00Z","updatedAt":"2026-04-30T09:10:00Z","tenantId":"tn_d7phk42ge9t9t6324f20","channel":"whatsapp","externalId":"112233445566778","createdBy":"usr_d7phosq4g7mv2l5b9l40","name":"+48 123 456 789","teamId":"tem_d7pi77577990sq67vgqg","status":{"state":"degraded","reasons":["payment_issue"]},"config":{"number":"+48123456789","wabaId":"102030405060708","verifiedName":"Support","qualityRating":"GREEN"}}]}},"Inbox":{"type":"object","description":"A connected channel account, such as a WhatsApp number or a Facebook Page, that\nFlownally sends and receives messages through.\n","required":["id","createdAt","updatedAt","tenantId","channel","externalId","createdBy","name","status"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"tenantId":{"type":"string","description":"Workspace ID."},"channel":{"type":"string","description":"Channel of the inbox. `textinc` is LiveChat.","enum":["whatsapp","messenger","instagram","textinc","twilio","genesys"]},"externalId":{"type":"string","description":"The channel's ID for the connected account, for example the WhatsApp phone number ID\nor the Facebook Page ID.\n"},"createdBy":{"type":"string","description":"ID of the user or service account that connected the inbox."},"name":{"type":"string","description":"Display name, for example the Facebook Page name or the phone number."},"teamId":{"type":"string","description":"Team that new sessions in this inbox's conversations go to. Absent when none."},"status":{"$ref":"#/components/schemas/InboxStatus"},"config":{"type":"object","description":"Public details of the connected account. Keys depend on the channel, for example\n`number` and `wabaId` for WhatsApp, `pageId` and `name` for Messenger, or `username`\nfor Instagram.\n","additionalProperties":{"type":"string"}}},"example":{"id":"ibx_d7pi2efp0k7nba4e1mt0","createdAt":"2026-04-30T09:00:00Z","updatedAt":"2026-04-30T09:10:00Z","tenantId":"tn_d7phk42ge9t9t6324f20","channel":"whatsapp","externalId":"112233445566778","createdBy":"usr_d7phosq4g7mv2l5b9l40","name":"+48 123 456 789","teamId":"tem_d7pi77577990sq67vgqg","status":{"state":"active","reasons":[]},"config":{"number":"+48123456789","wabaId":"102030405060708","verifiedName":"Support","qualityRating":"GREEN"}}},"InboxStatus":{"type":"object","description":"Whether the inbox can send and receive messages.","required":["state","reasons"],"properties":{"state":{"$ref":"#/components/schemas/InboxStatusState"},"reasons":{"type":"array","description":"Why the inbox isn't `active`. Empty when it is.","items":{"$ref":"#/components/schemas/InboxStatusReason"}},"issues":{"type":"array","description":"The provider's own explanation of a `messaging_restricted` reason, in its\nwords. Absent otherwise.\n","items":{"$ref":"#/components/schemas/InboxStatusIssue"}}},"example":{"state":"degraded","reasons":["messaging_restricted"],"issues":[{"code":"141014","description":"The WABA is banned.","solution":"Please visit Business Support Home for more details (https://business.facebook.com/accountquality) on how to appeal the ban."}]}},"InboxStatusState":{"type":"string","description":"Overall health of an inbox.","enum":["active","degraded","unavailable"]},"InboxStatusReason":{"type":"string","description":"Why an inbox isn't `active`.\n\n- `payment_issue`: WhatsApp rejects business-initiated messages until the\n  WhatsApp Business Account has a working payment method.\n- `phone_number_not_found`: WhatsApp no longer lists the inbox's phone number\n  on its WhatsApp Business Account, for example because it was deleted in\n  WhatsApp Manager. The inbox is `unavailable`.\n- `reconnect_required`: Meta no longer accepts the inbox's stored access, or\n  it lost access to the account. Connect the channel again. The inbox is\n  `unavailable`.\n- `messaging_restricted`: WhatsApp blocks or limits sending from the number.\n  This ranges from a banned WhatsApp Business Account to a block on\n  business-initiated messages only, for example without a Meta payment method\n  or at a conversation limit, where replies still go out. `issues` holds\n  WhatsApp's explanation. The inbox is `degraded`.\n","enum":["payment_issue","phone_number_not_found","reconnect_required","messaging_restricted"]},"InboxStatusIssue":{"type":"object","required":["description"],"properties":{"code":{"type":"string","description":"The provider's error code. Absent for a limit without an error."},"description":{"type":"string","description":"The provider's description of the problem."},"solution":{"type":"string","description":"What the provider suggests doing about it."}}},"ProblemDetails":{"type":"object","description":"RFC 9457 Problem Details response with a stable Flownally error code.","required":["type","title","status"],"properties":{"type":{"type":"string","format":"uri","description":"URI identifying the problem type, based on the HTTP status (for example `https://api.flownally.com/problems/404`). Use `code` to tell errors apart.","example":"https://api.flownally.com/problems/404"},"title":{"type":"string","description":"Standard text for the HTTP status.","example":"Not Found"},"status":{"type":"integer","description":"HTTP status code.","example":404},"detail":{"type":"string","description":"Human-readable explanation of this error, for logs. Don't parse it; branch on `code`.","example":"contact not found"},"instance":{"type":"string","format":"uri","description":"Not set by Flownally."},"code":{"type":"string","description":"Stable machine-readable error code. Branch on this value.","example":"contacts_contact_not_found"},"traceId":{"type":"string","description":"Trace ID in W3C `traceparent` format. Include it when you contact support.","example":"00-7b3a8c2e5d4f4a6c9e1d2f3a4b5c6d7e-0f1e2d3c4b5a6978-01"},"errors":{"type":"array","description":"Fields that failed validation, on `400` responses.","items":{"$ref":"#/components/schemas/FieldViolation"}},"messagingWindow":{"$ref":"#/components/schemas/MessagingWindow"}}},"FieldViolation":{"type":"object","description":"A request field that failed validation.","required":["field","code","message"],"properties":{"field":{"type":"string","example":"email"},"code":{"type":"string","example":"bad_format"},"message":{"type":"string","example":"must be a valid email"}}},"MessagingWindow":{"type":"object","description":"Whether `forActor` can reply in this conversation right now. The window restarts with\neach customer message and lasts as long as the channel allows. `state` is evaluated when\nthe response is built; `expiresAt` is the authority, so re-derive the state from it\ninstead of polling. A conversation has no `messagingWindow` on channels without a window\nor on a session's messages page.\n","required":["state","forActor"],"properties":{"state":{"type":"string","enum":["OPEN","CLOSED"]},"forActor":{"type":"string","description":"Whose replies the window applies to. `AGENT` covers teammates; `BOT` covers automated\nsenders such as chatbots, journeys and API keys.\n","enum":["AGENT","BOT"]},"expiresAt":{"type":"string","format":"date-time","description":"When the window closes. Absent when the customer hasn't written yet."},"failureCode":{"type":"string","description":"Why `forActor` can't send in this conversation right now.","enum":["messagingWindowClosed","inboxRequired","unsupportedChannel"]}},"example":{"state":"OPEN","forActor":"AGENT","expiresAt":"2026-05-01T10:35:00Z"}},"CreateInboxRequest":{"type":"object","description":"Accounts to connect, for exactly one channel per request.","oneOf":[{"$ref":"#/components/schemas/CreateMessengerInboxRequest"},{"$ref":"#/components/schemas/CreateInstagramInboxRequest"},{"$ref":"#/components/schemas/CreateTextIncInboxRequest"},{"$ref":"#/components/schemas/CreateTwilioInboxRequest"}]},"CreateMessengerInboxRequest":{"description":"Connect Facebook Pages as Messenger inboxes.","type":"object","required":["messenger"],"properties":{"messenger":{"$ref":"#/components/schemas/MessengerInboxRequest"}}},"MessengerInboxRequest":{"type":"object","description":"Facebook Pages to connect for Messenger conversations.","required":["resourceIds"],"properties":{"resourceIds":{"type":"array","items":{"type":"string"},"description":"Facebook Page IDs."}}},"CreateInstagramInboxRequest":{"description":"Connect Instagram accounts as Instagram inboxes.","type":"object","required":["instagram"],"properties":{"instagram":{"$ref":"#/components/schemas/InstagramInboxRequest"}}},"InstagramInboxRequest":{"type":"object","description":"Instagram business accounts to connect.","required":["resourceIds"],"properties":{"resourceIds":{"type":"array","items":{"type":"string"},"description":"Instagram business account IDs."}}},"CreateTextIncInboxRequest":{"description":"Connect a LiveChat organization as a desk inbox (channel `textinc`).","type":"object","required":["textinc"],"properties":{"textinc":{"$ref":"#/components/schemas/TextIncInboxRequest"}}},"TextIncInboxRequest":{"type":"object","description":"LiveChat organization to connect.","required":["organizationId"],"properties":{"organizationId":{"type":"string","description":"LiveChat organization ID."}}},"CreateTwilioInboxRequest":{"description":"Connect Twilio phone numbers as Twilio inboxes.","type":"object","required":["twilio"],"properties":{"twilio":{"$ref":"#/components/schemas/TwilioInboxRequest"}}},"TwilioInboxRequest":{"type":"object","description":"Twilio phone numbers to connect, with the credential that lists them.","required":["pendingCredentialId","phoneNumberIds"],"properties":{"pendingCredentialId":{"type":"string","description":"`pendingCredentialId` returned by `POST /twilio/{accountSid}/phone-numbers`. Use it\nwithin 30 minutes, as the same service account or user that listed the numbers.\n"},"phoneNumberIds":{"type":"array","items":{"type":"string"},"description":"`phoneNumberSid` values of the numbers to connect, from the same listing. Each must\nstill be on the Twilio account.\n"}}},"CreateInboxResponse":{"type":"object","description":"Inboxes for the connected accounts.","required":["inboxes"],"properties":{"inboxes":{"type":"array","items":{"$ref":"#/components/schemas/Inbox"}}}},"SetInboxTeamRequest":{"type":"object","description":"Team for new sessions in this inbox's conversations.","required":["teamId"],"properties":{"teamId":{"type":"string","description":"Team ID."}},"example":{"teamId":"tem_d7pi77577990sq67vgqg"}},"InboxForwarding":{"type":"object","description":"Rules that forward an inbox's sessions to a desk inbox.","required":["rules"],"properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/InboxForwardingRule"}}},"example":{"rules":[{"teamId":null,"to":"ibx_d9osd0q9io6g00blmdg0","groupId":128},{"teamId":"tem_d7pi77577990sq67vgqg","to":"ibx_d9osd0q9io6g00blmdg0","groupId":5},{"teamId":"tem_d7pi7b577990sq67vh2g"}]}},"InboxForwardingRule":{"type":"object","description":"A forwarding rule. An inbox has at most one default rule and at most one rule per team.\n","properties":{"teamId":{"description":"Team whose sessions the rule covers. Null or absent for the default rule, which also\ncovers teams without a rule of their own.\n","anyOf":[{"type":"string"},{"type":"null"}]},"to":{"type":"string","description":"ID of the desk inbox, a LiveChat (`textinc`) or Genesys inbox, that receives these\nsessions. Absent keeps them in Flownally.\n"},"groupId":{"type":"integer","minimum":0,"description":"LiveChat group that new chats start in. Only for a LiveChat `to`. `0` is the default\ngroup of the LiveChat license.\n"}}},"WhatsAppTemplatesResponse":{"type":"object","description":"WhatsApp templates available for outbound template messages.","required":["templates"],"properties":{"templates":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppTemplate"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."}},"example":{"templates":[{"id":"987654321","name":"order_ready","language":"en","status":"APPROVED","category":"UTILITY","components":[{"type":"BODY","text":"Hi {{1}}, your order {{2}} is ready for pickup."}]}]}},"WhatsAppTemplate":{"type":"object","description":"WhatsApp message template synced from Meta.","required":["id","name","language","status","category"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"status":{"type":"string","enum":["APPROVED","PENDING","REJECTED"]},"category":{"type":"string","enum":["MARKETING","UTILITY","AUTHENTICATION"]},"components":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppTemplateComponent"}}}},"WhatsAppTemplateComponent":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"format":{"type":"string"},"text":{"type":"string"},"buttons":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppTemplateButton"}}}},"WhatsAppTemplateButton":{"type":"object","required":["type","text"],"properties":{"type":{"type":"string"},"text":{"type":"string"},"url":{"type":"string"},"phoneNumber":{"type":"string"}}},"WhatsAppFlowsResponse":{"type":"object","description":"Published Meta WhatsApp Flows available for interactive messages.","required":["flows"],"properties":{"flows":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppFlow"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."}}},"WhatsAppFlow":{"type":"object","description":"A published WhatsApp Flow synced from Meta.","required":["id","name","status","categories"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}}}},"InstagramMediaType":{"type":"string","enum":["post","reel","story"]},"InstagramMediaResponse":{"type":"object","required":["media"],"properties":{"media":{"type":"array","items":{"$ref":"#/components/schemas/InstagramMedia"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."}}},"InstagramMedia":{"type":"object","required":["id","type","caption","permalink","mediaUrl","thumbnailUrl"],"properties":{"id":{"type":"string"},"type":{"$ref":"#/components/schemas/InstagramMediaType"},"caption":{"type":"string"},"permalink":{"type":"string"},"mediaUrl":{"type":"string"},"thumbnailUrl":{"type":"string"},"publishedAt":{"type":"string","format":"date-time"}}},"WABAPhoneNumbersResponse":{"type":"object","description":"Phone numbers available on a WhatsApp Business Account.","required":["phoneNumbers"],"properties":{"phoneNumbers":{"type":"array","items":{"$ref":"#/components/schemas/WABAPhoneNumber"}}},"example":{"phoneNumbers":[{"id":"112233445566778","displayPhoneNumber":"+48 123 456 789","verifiedName":"Flownally Support","qualityRating":"GREEN","codeVerificationStatus":"","isRegistered":true}]}},"WABAPhoneNumber":{"type":"object","description":"A phone number on a WhatsApp Business Account.","required":["id","displayPhoneNumber","verifiedName","qualityRating","codeVerificationStatus","isRegistered"],"properties":{"id":{"type":"string"},"displayPhoneNumber":{"type":"string"},"verifiedName":{"type":"string"},"qualityRating":{"type":"string"},"codeVerificationStatus":{"type":"string"},"isRegistered":{"type":"boolean"}}},"ListTwilioPhoneNumbersRequest":{"type":"object","description":"Twilio credential used to list the account's phone numbers.","required":["authToken"],"properties":{"authToken":{"type":"string","format":"password","description":"Twilio Auth Token."}}},"TwilioPhoneNumbersResponse":{"type":"object","description":"Phone numbers on the Twilio account.","required":["pendingCredentialId","phoneNumbers"],"properties":{"pendingCredentialId":{"type":"string","description":"Pass as `twilio.pendingCredentialId` to `POST /inboxes` within 30 minutes."},"phoneNumbers":{"type":"array","items":{"$ref":"#/components/schemas/TwilioPhoneNumber"}}},"example":{"pendingCredentialId":"pcr_d7pk0g5hrlnflntmp74g","phoneNumbers":[{"phoneNumberSid":"PN1234567890abcdef1234567890abcdef","phoneNumber":"+15557650000","friendlyName":"Support","capabilities":{"sms":true,"mms":true,"voice":false}}]}},"TwilioPhoneNumber":{"type":"object","description":"A phone number on the Twilio account.","required":["phoneNumberSid","phoneNumber","capabilities"],"properties":{"phoneNumberSid":{"type":"string","description":"Twilio phone number SID. Pass it in `twilio.phoneNumberIds` to connect the number.\n"},"phoneNumber":{"type":"string","description":"Phone number in E.164 format."},"friendlyName":{"type":"string"},"capabilities":{"$ref":"#/components/schemas/TwilioPhoneNumberCapabilities"}}},"TwilioPhoneNumberCapabilities":{"type":"object","description":"Capabilities that Twilio reports for this phone number.","required":["sms","mms","voice"],"properties":{"sms":{"type":"boolean"},"mms":{"type":"boolean"},"voice":{"type":"boolean"}}},"UsersResponse":{"type":"object","description":"Workspace members.","required":["users"],"properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}},"User":{"type":"object","description":"Person who can work in the Flownally workspace.","required":["id","name","email","teamIds","role","joinedAt","provider","emailVerified","disabled"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"teamIds":{"type":"array","description":"Teams this user belongs to.","items":{"type":"string"}},"role":{"type":"string","description":"The member's role, such as `owner`, `admin` or `agent`."},"joinedAt":{"type":"string","format":"date-time","description":"When the user joined the workspace."},"avatarMediaId":{"type":"string","pattern":"^mda_[0-9a-v]{20}$","description":"Media ID of the profile image, when one is set."},"provider":{"type":"string","enum":["password","email","google","facebook"],"description":"Identity provider the user signed in with."},"emailVerified":{"type":"boolean"},"disabled":{"type":"boolean"}},"example":{"id":"usr_d7phosq4g7mv2l5b9l40","name":"Lina Nowak","email":"lina@example.com","teamIds":["tem_d7pi77577990sq67vgqg"],"role":"admin","joinedAt":"2026-04-30T08:30:00Z","avatarMediaId":"mda_d7pk2v0s4g7mv2l5b9m0","provider":"google","emailVerified":true,"disabled":false}},"UpdateProfileRequest":{"type":"object","description":"Profile fields to update for the authenticated user.","properties":{"name":{"type":"string"},"avatarMediaId":{"type":"string","pattern":"^(?:mda_[0-9a-v]{20})?$","description":"Media ID of an uploaded image. An empty string clears the avatar."}},"example":{"name":"Lina Nowak","avatarMediaId":"mda_d7pk2v0s4g7mv2l5b9m0"}},"UnreadSummaryResponse":{"type":"object","required":["unreadConversations","conversationUnread"],"additionalProperties":false,"properties":{"conversationUnread":{"type":"object","additionalProperties":{"type":"boolean"},"description":"Requested conversation IDs mapped to unread state within the caller's access scope. Unknown or inaccessible IDs return false."},"unreadConversations":{"type":"integer","format":"int64","description":"Number of accessible conversations with unread customer or other-agent activity for the caller, across all owners and statuses."}}},"UpdateUserRoleRequest":{"type":"object","description":"Role assignment for a workspace member.","required":["role"],"properties":{"role":{"type":"string","enum":["owner","admin","agent"],"description":"The role to assign to the member."}},"example":{"role":"agent"}},"ListTeamsResponse":{"type":"object","description":"Paginated teams in the workspace.","required":["teams"],"properties":{"teams":{"type":"array","items":{"$ref":"#/components/schemas/Team"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"Team":{"type":"object","description":"Group of teammates used for inbox routing and conversation access.","required":["id","createdAt","updatedAt","tenantId","name","description","agentIds"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"tenantId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"agentIds":{"type":"array","description":"Users assigned to this team (membership via `/teams/{id}/agents`).\n","items":{"type":"string"}}},"example":{"id":"tem_d7pi77577990sq67vgqg","createdAt":"2026-04-30T08:45:00Z","updatedAt":"2026-04-30T09:05:00Z","tenantId":"tn_d7phk42ge9t9t6324f20","name":"Support","description":"First line customer support.","agentIds":["usr_d7phosq4g7mv2l5b9l40"]}},"CreateTeamRequest":{"type":"object","description":"Team to create.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500}},"example":{"name":"Support","description":"First line customer support."}},"UpdateTeamRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500}}},"ListTeamAgentsResponse":{"type":"object","required":["agents"],"properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/TeamMembership"}}}},"TeamMembership":{"type":"object","description":"Membership link between a user and a team.","required":["id","createdAt","tenantId","teamId","userId"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"tenantId":{"type":"string"},"teamId":{"type":"string"},"userId":{"type":"string"}}},"AddAgentToTeamRequest":{"type":"object","description":"User to add to the team.","required":["userId"],"properties":{"userId":{"type":"string"}},"example":{"userId":"usr_d7phosq4g7mv2l5b9l40"}},"CreateMessageRequest":{"type":"object","description":"Body for sending a message to a conversation, contact or phone number.","required":["recipient","content"],"properties":{"expectedContext":{"$ref":"#/components/schemas/InboxActionContext"},"inboxId":{"type":"string","description":"Sending inbox ID. Required for `contact` and `phone` recipients. For a `conversation`\nrecipient it's optional and must match the conversation's `inboxId`.\n"},"recipient":{"$ref":"#/components/schemas/MessageRecipient"},"content":{"$ref":"#/components/schemas/OutboundMessageContent"},"contexts":{"type":"array","maxItems":1,"description":"The message this one replies to, in the recipient's conversation. Not supported for\n`phone` recipients, or for `contact` recipients without a conversation in the inbox.\n","items":{"$ref":"#/components/schemas/SendMessageContext"}}},"example":{"inboxId":"ibx_d7pi2efp0k7nba4e1mt0","recipient":{"type":"phone","phoneNumber":"+48123456789"},"content":{"type":"template","template":{"name":"order_ready","language":"en","components":[{"type":"body","parameters":[{"type":"text","text":"Anna"},{"type":"text","text":"4827"}]}]}}}},"InboxActionContext":{"type":"object","description":"The conversation state a client acted on. Pass the `actionContext` you received back\nunchanged as `expectedContext`. Every field is compared for exact equality\n(`substantiveVersion` only when you send it). If the conversation changed, for example a\nnew session started, the owner changed or a new message arrived, the request fails with\n`409` and code `messaging_inbox_context_changed`. Reload the conversation and retry; for\nmessage sends, use a new `Idempotency-Key`.\n","required":["sessionId","ownerType","ownerId","lastSubstantiveMessageId"],"properties":{"sessionId":{"type":"string"},"ownerType":{"type":"string","description":"`user`, `chatbot`, `journey`, `service_account`, `inbox` or `external`, the same as\n`activeOwner`. Empty when the session is unassigned.\n"},"ownerId":{"type":"string"},"lastSubstantiveMessageId":{"type":"string","description":"Changes when a message is sent or received in the current session."},"substantiveVersion":{"type":"string","description":"Opaque version that changes when a message in the conversation is edited or deleted.\nDelivery and read receipts don't change it.\n"}}},"MessageRecipient":{"description":"Who to send the message to: an existing conversation, a contact or a phone number.\n","oneOf":[{"$ref":"#/components/schemas/ConversationRecipient"},{"$ref":"#/components/schemas/ContactRecipient"},{"$ref":"#/components/schemas/PhoneRecipient"}],"discriminator":{"propertyName":"type","mapping":{"conversation":"#/components/schemas/ConversationRecipient","contact":"#/components/schemas/ContactRecipient","phone":"#/components/schemas/PhoneRecipient"}},"example":{"type":"phone","phoneNumber":"+48123456789"}},"ConversationRecipient":{"type":"object","description":"Send to an existing conversation.","required":["type","conversationId"],"properties":{"type":{"type":"string","const":"conversation"},"conversationId":{"type":"string"}}},"ContactRecipient":{"type":"object","description":"Send to a contact through the `inboxId` inbox. Flownally uses the contact's conversation\nin that inbox when there is one; otherwise it sends to the phone number in the contact's\n`cf_phone` custom field.\n","required":["type","contactId"],"properties":{"type":{"type":"string","const":"contact"},"contactId":{"type":"string"}}},"PhoneRecipient":{"type":"object","description":"Send to a phone number through the `inboxId` inbox. The inbox's channel must support\nsending to phone numbers, such as WhatsApp or Twilio; other channels return `400`.\n","required":["type","phoneNumber"],"properties":{"type":{"type":"string","const":"phone"},"phoneNumber":{"type":"string","description":"E.164 phone number. Common formatting is accepted and normalized."}}},"OutboundMessageContent":{"x-ogen-name":"OutboundMessageContent","description":"Message body to send, selected by `type`: `text` for plain text, `media` for a file,\n`template` for a WhatsApp template, `richMessage` for cards and buttons, or `whatsapp`\nfor WhatsApp-only features.\n","oneOf":[{"$ref":"#/components/schemas/TextMessageContent"},{"$ref":"#/components/schemas/MediaMessageContent"},{"$ref":"#/components/schemas/TemplateMessageContent"},{"$ref":"#/components/schemas/RichMessageContent"},{"$ref":"#/components/schemas/WhatsAppMessageContent"}],"discriminator":{"propertyName":"type","mapping":{"text":"#/components/schemas/TextMessageContent","media":"#/components/schemas/MediaMessageContent","template":"#/components/schemas/TemplateMessageContent","richMessage":"#/components/schemas/RichMessageContent","whatsapp":"#/components/schemas/WhatsAppMessageContent"}}},"TextMessageContent":{"type":"object","description":"Plain text message content.","required":["type","text"],"properties":{"type":{"type":"string","const":"text"},"text":{"$ref":"#/components/schemas/TextContent"}},"example":{"type":"text","text":{"body":"Hi Anna, your order is ready for pickup."}}},"TextContent":{"type":"object","description":"Plain text body.","required":["body"],"properties":{"body":{"type":"string"}}},"MediaMessageContent":{"type":"object","description":"Media message content. Upload the file with `POST /media/uploads` first, then pass the\nreturned `mediaId`.\n","required":["type","media"],"properties":{"type":{"type":"string","const":"media"},"media":{"$ref":"#/components/schemas/MediaContent"}},"example":{"type":"media","media":{"mediaId":"mda_d7pka1i9v5sfp2ud6chg","caption":"Your invoice is attached.","filename":"invoice-4827.pdf","mimeType":"application/pdf","mediaType":"document"}}},"MediaContent":{"type":"object","additionalProperties":false,"description":"A Flownally media file and optional display details. To download the file, call\n`GET /media/{mediaId}` for a download URL.\n","required":["mediaId"],"properties":{"mediaId":{"type":"string","pattern":"^(?:mda_[0-9a-v]{20}|chm_[0-9a-f]{32})$","description":"Media ID returned by `POST /media/uploads`, or the ID of media on a received message.\n"},"caption":{"type":"string"},"filename":{"type":"string"},"mimeType":{"type":"string"},"fileSize":{"type":"integer","format":"int64"},"mediaType":{"type":"string","enum":["image","document","video","audio"]}}},"TemplateMessageContent":{"type":"object","description":"WhatsApp template message content. Use the `name` and `language` of an `APPROVED`\ntemplate from `GET /inboxes/{id}/whatsapp/templates`.\n","required":["type","template"],"properties":{"type":{"type":"string","const":"template"},"template":{"$ref":"#/components/schemas/WhatsAppTemplateContent"}},"example":{"type":"template","template":{"name":"order_ready","language":"en","components":[{"type":"body","parameters":[{"type":"text","text":"Anna"},{"type":"text","text":"4827"}]}]}}},"WhatsAppTemplateContent":{"type":"object","required":["name","language"],"properties":{"name":{"type":"string"},"language":{"type":"string"},"components":{"type":"array","items":{"$ref":"#/components/schemas/TemplateComponent"}}}},"TemplateComponent":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["header","body","button"]},"subType":{"type":"string"},"index":{"type":"integer"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/TemplateParameter"}}}},"TemplateParameter":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["text","image","document","video","currency","dateTime","payload"]},"text":{"type":"string"},"payload":{"type":"string"},"image":{"$ref":"#/components/schemas/MediaParameter"},"document":{"$ref":"#/components/schemas/MediaParameter"},"video":{"$ref":"#/components/schemas/MediaParameter"},"currency":{"$ref":"#/components/schemas/CurrencyParameter"},"dateTime":{"$ref":"#/components/schemas/DateTimeParameter"}}},"MediaParameter":{"type":"object","required":["link"],"properties":{"link":{"type":"string"},"filename":{"type":"string"}}},"CurrencyParameter":{"type":"object","required":["fallbackValue","code","amount1000"],"properties":{"fallbackValue":{"type":"string"},"code":{"type":"string"},"amount1000":{"type":"integer","format":"int64"}}},"DateTimeParameter":{"type":"object","required":["fallbackValue"],"properties":{"fallbackValue":{"type":"string"}}},"RichMessageContent":{"type":"object","description":"Structured rich message content for channels that support cards or actions.","required":["type","richMessage"],"properties":{"type":{"type":"string","const":"richMessage"},"richMessage":{"$ref":"#/components/schemas/RichMessage"}},"example":{"type":"richMessage","richMessage":{"cards":[{"body":{"text":"Choose the next step."},"actions":[{"type":"reply","label":"Talk to support","value":"support"}]}]}}},"RichMessage":{"type":"object","required":["cards"],"properties":{"cards":{"type":"array","items":{"$ref":"#/components/schemas/Card"}}}},"Card":{"type":"object","properties":{"header":{"$ref":"#/components/schemas/CardHeader"},"body":{"$ref":"#/components/schemas/CardBody"},"footer":{"$ref":"#/components/schemas/CardFooter"},"actions":{"type":"array","items":{"$ref":"#/components/schemas/CardAction"}}}},"CardHeader":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string"},"text":{"type":"string"},"mediaId":{"type":"string","pattern":"^(?:mda_[0-9a-v]{20}|chm_[0-9a-f]{32})$"},"mimeType":{"type":"string"},"filename":{"type":"string"},"thumbnailUrl":{"type":"string"}}},"CardBody":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}}},"CardFooter":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}}},"CardAction":{"type":"object","required":["type","label","value"],"properties":{"type":{"type":"string"},"label":{"type":"string"},"value":{"type":"string"},"flow":{"$ref":"#/components/schemas/WhatsAppFlowAction"}}},"WhatsAppFlowAction":{"type":"object","required":["flowId","flowToken"],"properties":{"flowId":{"type":"string"},"flowToken":{"type":"string","minLength":1},"screen":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}}},"WhatsAppMessageContent":{"type":"object","description":"WhatsApp-specific message content.","required":["type","whatsapp"],"properties":{"type":{"type":"string","const":"whatsapp"},"whatsapp":{"$ref":"#/components/schemas/WhatsAppContent"}},"example":{"type":"whatsapp","whatsapp":{"requestContactInfo":{"body":"Please share your WhatsApp phone number."}}}},"WhatsAppContent":{"type":"object","description":"WhatsApp-only message features.","properties":{"requestContactInfo":{"$ref":"#/components/schemas/WhatsAppRequestContactInfoContent"}}},"WhatsAppRequestContactInfoContent":{"type":"object","description":"WhatsApp interactive message that asks the customer to share their phone number.","required":["body"],"properties":{"body":{"type":"string","description":"Body text shown above the WhatsApp contact information request button."}}},"SendMessageContext":{"type":"object","required":["relation","reference"],"properties":{"relation":{"type":"string","enum":["replyTo"]},"reference":{"$ref":"#/components/schemas/MessageContextMessageReference"}}},"MessageContextMessageReference":{"type":"object","required":["type","messageId"],"properties":{"type":{"type":"string","const":"message"},"messageId":{"type":"string","minLength":5,"maxLength":128,"pattern":"^msg_[a-z0-9]+$"}}},"SendMessageResponse":{"type":"object","description":"Returned after Flownally accepts a message for delivery. To send several messages in\norder, pass `actionContext` as `expectedContext` with the next message.\n","required":["message"],"properties":{"actionContext":{"$ref":"#/components/schemas/InboxActionContext"},"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"}},"example":{"message":{"id":"msg_d7pj3rljs4umccbo6tdg","createdAt":"2026-04-30T10:36:00.412305Z","updatedAt":"2026-04-30T10:36:00Z","tenantId":"tn_d7phk42ge9t9t6324f20","conversationId":"cnv_d7pigoip4tfcdebp5mlg","senderType":"user","senderId":"usr_d7phosq4g7mv2l5b9l40","content":{"type":"template","template":{"name":"order_ready","language":"en"}},"deliveryStatus":"pending"},"conversation":{"id":"cnv_d7pigoip4tfcdebp5mlg","channel":"whatsapp","externalId":"US.13491208655302741918","inboxId":"ibx_d7pi2efp0k7nba4e1mt0","name":"Anna Kowalska","contactId":"con_d7pibvs6gljrc2pfdc1g","contactName":"Anna Kowalska","status":"open","lastMessageAt":"2026-04-30T10:36:00Z","lastMessagePreview":"order_ready","lastMessageSender":"user"}}},"Message":{"type":"object","description":"Message record with content, delivery state, and channel delivery context.","required":["id","createdAt","updatedAt","tenantId","conversationId","senderType","senderId","content","deliveryStatus"],"properties":{"revision":{"type":"integer","format":"int64"},"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time","x-ogen-time-format":"2006-01-02T15:04:05.000000Z07:00","description":"When Flownally stored the message. For inbound messages this is after Flownally\nreceived the message, not when the customer sent it. UTC with exactly six\nfractional digits (microseconds), for example `2026-04-30T10:36:00.412305Z`, so\ncomparing the strings orders messages. Several messages can have the same\n`createdAt`; keep the order the API returns.\n"},"updatedAt":{"type":"string","format":"date-time"},"tenantId":{"type":"string","description":"Workspace ID."},"conversationId":{"type":"string"},"sessionId":{"type":"string","description":"The session that handled the message. Only the customer and teammates start sessions,\nso a message sent while the conversation had no active session by anyone else, for\nexample a journey, campaign, API key or connected inbox, has no `sessionId`. Neither\ndoes an observed message from such a time. A message never gains a session later.\n"},"kind":{"type":"string","description":"Timeline entry kind. Only `message` entries travel over a channel.","enum":["message","observation","note","system"]},"senderType":{"type":"string","enum":["customer","user","journey","bot","campaign","service_account","inbox","system","external"],"description":"Who caused the entry. `system` marks entries caused by Flownally itself, such as an\nautomatic session close. `external` marks replies from a responder Flownally\ndoesn't run that answers on the business's number, such as Meta Business Agent;\n`senderId` names it.\n"},"senderId":{"type":"string"},"content":{"description":"Message content, or null when the message has been deleted.","oneOf":[{"$ref":"#/components/schemas/MessageContent"},{"type":"null"}]},"deliveryStatus":{"type":"string","description":"Delivery state of the message. Statuses only move forward:\n\n- `pending` can become `unknown`, `sent`, `delivered`, `read` or `failed`.\n- `unknown` can become `sent`, `delivered`, `read` or `failed`.\n- `sent` can become `delivered`, `read` or `failed`.\n- `delivered` can become `read`.\n- `read` and `failed` are final.\n\n`unknown` means the call to the channel ended without a clear result, so the message\nmay have been delivered. Don't resend it automatically.\n","enum":["pending","sent","delivered","read","failed","unknown"]},"channelMessageId":{"type":"string","description":"The channel's own ID for the message, for example a WhatsApp `wamid`."},"clientMessageId":{"type":"string","description":"The `Idempotency-Key` sent with an outbound message, so you can match the message to\nyour request.\n"},"failureCode":{"type":"string","description":"Why the delivery failed. Present only when `deliveryStatus` is `failed`. New values may\nbe added, so treat an unknown value as `delivery_failed`, and treat a failed message\nwithout `failureCode` the same way.\n\n- `messaging_window_closed`: the customer's reply window closed.\n- `recipient_unavailable`: the customer can't receive messages on this channel.\n- `recipient_opted_out`: the customer opted out of these messages from the business, such as marketing.\n- `frequency_limited`: the channel is limiting messages to this customer for now.\n- `reconnect_required`: the channel needs to be reconnected.\n- `channel_restricted`: the channel's business account is restricted.\n- `channel_payment_issue`: the business account has a payment issue with Meta.\n- `contact_limit_reached`: the workspace reached its active contacts limit.\n- `messaging_blocked`: the workspace's plan or billing doesn't allow sending messages right now.\n- `content_unsupported`: the channel doesn't support this message type or attachment.\n- `media_too_large`: the attachment is too large for the channel.\n- `template_unavailable`: the template is missing, paused or disabled, or its parameters don't match.\n- `private_reply_used`: Instagram allows only one private reply to a comment.\n- `customer_banned`: the customer is banned on this conversation.\n- `held_externally`: the number is shared with another responder, such as Meta's AI agent, and Flownally doesn't control this conversation.\n- `delivery_failed`: any other failure.\n","x-extensible-enum":["messaging_window_closed","recipient_unavailable","recipient_opted_out","frequency_limited","reconnect_required","channel_restricted","channel_payment_issue","contact_limit_reached","messaging_blocked","content_unsupported","media_too_large","template_unavailable","private_reply_used","customer_banned","held_externally","delivery_failed"]},"failureReason":{"type":"string","description":"One English sentence explaining `failureCode`, present whenever `failureCode` is. It\nnever contains channel or provider error text. Don't parse it; branch on `failureCode`.\n"},"editedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time"},"reactions":{"type":"array","items":{"$ref":"#/components/schemas/Reaction"}},"contexts":{"type":"array","maxItems":2,"items":{"$ref":"#/components/schemas/MessageContext"}}},"example":{"id":"msg_d7pj3rljs4umccbo6tdg","createdAt":"2026-04-30T10:36:00.412305Z","updatedAt":"2026-04-30T10:36:02Z","tenantId":"tn_d7phk42ge9t9t6324f20","conversationId":"cnv_d7pigoip4tfcdebp5mlg","senderType":"user","senderId":"usr_d7phosq4g7mv2l5b9l40","content":{"type":"text","text":{"body":"Hi Anna, your order is ready for pickup."}},"deliveryStatus":"delivered","channelMessageId":"wamid.HBgLMjQxMjM0NTY3ODkVAgARGBI","clientMessageId":"reply-4827-1"}},"MessageContent":{"x-ogen-name":"MessageContent","description":"Message body, selected by `type`. `text`, `media`, `template`, `richMessage` and\n`whatsapp` are the types you can send. `formResponse`, `location` and `interactiveReply`\ncome from customers, and `system` marks events in the conversation timeline.\n","oneOf":[{"$ref":"#/components/schemas/TextMessageContent"},{"$ref":"#/components/schemas/MediaMessageContent"},{"$ref":"#/components/schemas/TemplateMessageContent"},{"$ref":"#/components/schemas/RichMessageContent"},{"$ref":"#/components/schemas/WhatsAppMessageContent"},{"$ref":"#/components/schemas/FormResponseMessageContent"},{"$ref":"#/components/schemas/LocationMessageContent"},{"$ref":"#/components/schemas/InteractiveReplyMessageContent"},{"$ref":"#/components/schemas/SystemMessageContent"}],"discriminator":{"propertyName":"type","mapping":{"text":"#/components/schemas/TextMessageContent","media":"#/components/schemas/MediaMessageContent","template":"#/components/schemas/TemplateMessageContent","richMessage":"#/components/schemas/RichMessageContent","whatsapp":"#/components/schemas/WhatsAppMessageContent","formResponse":"#/components/schemas/FormResponseMessageContent","location":"#/components/schemas/LocationMessageContent","interactiveReply":"#/components/schemas/InteractiveReplyMessageContent","system":"#/components/schemas/SystemMessageContent"}},"example":{"type":"text","text":{"body":"Hi Anna, your order is ready for pickup."}}},"FormResponseMessageContent":{"type":"object","description":"A customer's submitted answers from a channel form.","required":["type","formResponse"],"properties":{"type":{"type":"string","const":"formResponse"},"formResponse":{"$ref":"#/components/schemas/FormResponseContent"}}},"FormResponseContent":{"type":"object","required":["title","answers"],"properties":{"title":{"type":"string"},"answers":{"type":"object","additionalProperties":true}}},"LocationMessageContent":{"type":"object","description":"A location shared by a customer.","required":["type","location"],"properties":{"type":{"type":"string","const":"location"},"location":{"$ref":"#/components/schemas/LocationContent"}}},"LocationContent":{"type":"object","required":["latitude","longitude"],"properties":{"latitude":{"type":"number","format":"double"},"longitude":{"type":"number","format":"double"},"name":{"type":"string"},"address":{"type":"string"}}},"InteractiveReplyMessageContent":{"type":"object","description":"A customer's selection from an interactive message.","required":["type","interactiveReply"],"properties":{"type":{"type":"string","const":"interactiveReply"},"interactiveReply":{"$ref":"#/components/schemas/InteractiveReplyContent"}}},"InteractiveReplyContent":{"type":"object","required":["source","title","payload"],"properties":{"source":{"type":"string","enum":["button","list","quick_reply","referral_entry"]},"title":{"type":"string"},"payload":{"type":"string"},"sourceMessageId":{"type":"string"}}},"SystemMessageContent":{"type":"object","description":"Timeline entry that Flownally writes about the conversation. It is never sent to the\ncustomer. Events and their `params`:\n\n- `conversation.assigned`: `ownerType` (`user`, `chatbot`), `ownerId`.\n- `conversation.released`: `chatbotId`, `reason` (`completed`, `cancelled`).\n- `conversation.escalated`: `chatbotId`, `reason` (`escalated`, `failed`, `handoff`, or\n  `held_externally` when the chatbot gave up the conversation because an external holder\n  holds it), and `teamId` when the handoff moved the conversation to a team.\n- `conversation.closed`: `reason` (`manual`, `deadline`, or `completed`, written by the\n  chatbot whose run completed).\n- `conversation.held_externally`: `holderId` when the channel named the party that took\n  the conversation, or the party Flownally passed it to, such as `meta_business_agent`.\n- `conversation.control_returned`: `holderId` of the previous holder, when it was known,\n  and `reason` `escalated` when that holder handed the conversation back.\n\nNew events may be added. Ignore events you don't recognize.\n","required":["type","system"],"properties":{"type":{"type":"string","const":"system"},"system":{"$ref":"#/components/schemas/SystemContent"}},"example":{"type":"system","system":{"event":"conversation.assigned","params":{"ownerType":"user","ownerId":"usr_d7phosq4g7mv2l5b9l40"}}}},"SystemContent":{"type":"object","required":["event"],"properties":{"event":{"type":"string","description":"What happened, such as `conversation.assigned` or `conversation.closed`."},"params":{"type":"object","additionalProperties":true,"description":"Event details for rendering, such as the new owner or the close reason."}}},"Reaction":{"type":"object","required":["id","messageId","senderType","senderId","emoji","createdAt"],"properties":{"id":{"type":"string"},"messageId":{"type":"string"},"senderType":{"type":"string"},"senderId":{"type":"string"},"emoji":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"MessageContext":{"type":"object","required":["relation","reference"],"properties":{"relation":{"type":"string","enum":["replyTo","about"]},"reference":{"$ref":"#/components/schemas/MessageContextReference"},"resourceSnapshot":{"$ref":"#/components/schemas/ExternalResourceSnapshot"}}},"MessageContextReference":{"x-ogen-name":"MessageContextReference","oneOf":[{"$ref":"#/components/schemas/MessageContextMessageReference"},{"$ref":"#/components/schemas/MessageContextResourceReference"},{"$ref":"#/components/schemas/MessageContextUnavailableReference"}],"discriminator":{"propertyName":"type","mapping":{"message":"#/components/schemas/MessageContextMessageReference","resource":"#/components/schemas/MessageContextResourceReference","unavailable":"#/components/schemas/MessageContextUnavailableReference"}}},"MessageContextResourceReference":{"type":"object","required":["type","resourceType","channel","externalId"],"properties":{"type":{"type":"string","const":"resource"},"resourceType":{"type":"string"},"channel":{"type":"string"},"externalId":{"type":"string"}}},"MessageContextUnavailableReference":{"type":"object","required":["type"],"properties":{"type":{"type":"string","const":"unavailable"}}},"ExternalResourceSnapshot":{"type":"object","required":["resourceType","subtype","text","permalink","mediaUrl","thumbnailUrl","capturedAt"],"properties":{"resourceType":{"type":"string"},"subtype":{"type":"string"},"text":{"type":"string"},"permalink":{"type":"string"},"mediaUrl":{"type":"string"},"thumbnailUrl":{"type":"string"},"publishedAt":{"type":"string","format":"date-time"},"capturedAt":{"type":"string","format":"date-time"}}},"Conversation":{"type":"object","description":"A customer conversation as it appears in the shared Flownally inbox.","required":["id","channel","externalId","status","lastMessageAt","lastMessagePreview","lastMessageSender"],"properties":{"revision":{"type":"integer","format":"int64"},"waitingSince":{"description":"Use this to tell whether the conversation needs a reply: when the customer started\nwaiting in the current session. A reply from a teammate, an API key or an inbox (the\nbusiness's own phone or a connected desk) ends the wait once it is sent. A chatbot's\nreply doesn't end it but moves its start to the customer's first message the chatbot\nhasn't answered, or to their latest message, so a conversation a chatbot handed over\nshows as waiting. A reply from a responder Flownally doesn't run (`external`, such as\nMeta Business Agent) does the same. Journey and campaign messages are ignored. `null`\nwhen nobody is waiting for a reply, when the session is closed or owned by a chatbot,\njourney, API key or connected inbox, or while another responder holds the\nconversation.\n","anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"actionContext":{"$ref":"#/components/schemas/InboxActionContext"},"id":{"type":"string"},"channel":{"type":"string"},"externalId":{"type":"string","description":"The channel's identifier for the customer in this inbox. For WhatsApp it is the\nbusiness-scoped user ID when available, otherwise the phone number digits without `+`.\nIt can change; use `id` as the stable key.\n"},"inboxId":{"type":"string"},"name":{"type":"string"},"contactId":{"type":"string"},"contactName":{"type":"string"},"status":{"type":"string","description":"Status of the conversation's session. `pending` when the customer wrote after the last\nteammate, chatbot or `external` responder message, or a chatbot handed the conversation\nover; `open` when a teammate, chatbot or `external` responder wrote last. When an\nexternal responder hands the conversation back, the status stays as it is. API key, inbox, journey and campaign messages don't\nchange it. It changes when a message is accepted, so a reply that later fails to send\nleaves `open` while `waitingSince` stays set; use\n`waitingSince` for \"needs a reply\". `cold` when no session has handled it yet, for\nexample outreach nobody has answered.\n","enum":["cold","pending","open","closed"]},"activeOwner":{"$ref":"#/components/schemas/ConversationOwner"},"lastMessageAt":{"type":"string","format":"date-time"},"lastMessagePreview":{"type":"string"},"lastMessageSender":{"type":"string"},"lastMessageSenderId":{"type":"string","description":"ID of the latest message's sender, when available."},"ban":{"$ref":"#/components/schemas/ConversationBan"},"messagingWindow":{"$ref":"#/components/schemas/MessagingWindow"}},"example":{"id":"cnv_d7pigoip4tfcdebp5mlg","channel":"whatsapp","externalId":"US.13491208655302741918","inboxId":"ibx_d7pi2efp0k7nba4e1mt0","name":"Anna Kowalska","contactId":"con_d7pibvs6gljrc2pfdc1g","contactName":"Anna Kowalska","status":"open","activeOwner":{"type":"user","id":"usr_d7phtlmtf1g6fu9aj6jg"},"lastMessageAt":"2026-04-30T10:35:00Z","lastMessagePreview":"Thanks, I will check it now.","lastMessageSender":"customer"}},"ConversationOwner":{"type":"object","required":["type"],"properties":{"type":{"type":"string","description":"`external` means a party Flownally does not run, such as Meta's AI agent, is answering\nthe customer. `id` names it, or is `unknown` when the channel doesn't say. The session\nowner shows again when control comes back.\n","enum":["user","chatbot","journey","service_account","inbox","external"]},"id":{"type":"string"}}},"ConversationBan":{"type":"object","description":"The customer's ban, for this conversation's customer identity in this inbox only. Absent\nwhen the customer isn't banned or the ban has expired.\n","required":["bannedAt","bannedBy"],"properties":{"bannedAt":{"type":"string","format":"date-time","description":"When the customer was banned."},"bannedBy":{"$ref":"#/components/schemas/ConversationBanActor"},"expiresAt":{"type":"string","format":"date-time","description":"When the ban ends. Absent when it lasts until the customer is unbanned."},"reason":{"type":"string","description":"Why the customer was banned. Absent when no reason was given."}}},"ConversationBanActor":{"type":"object","description":"Who banned the customer.","required":["type","id"],"properties":{"type":{"type":"string","description":"New values may be added.","x-extensible-enum":["user","service_account"]},"id":{"type":"string"}}},"GetMessageResponse":{"type":"object","description":"A message and the conversation it belongs to.","required":["message","conversation"],"properties":{"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"}}},"MediaDownloadURLResponse":{"type":"object","description":"Download state of a media file.","required":["ready"],"properties":{"ready":{"type":"boolean","description":"Whether the file can be downloaded from `url`. `false` without `failureCode` means\nFlownally is still storing it.\n"},"failureCode":{"type":"string","description":"Present only when the media failed permanently; it will never become\navailable and `ready` stays `false`. Known codes (the list may grow, so\ntreat unknown codes as permanent failures too):\n\n- `media_unavailable`: the source provider no longer has the file.\n- `media_too_large`: the file exceeds the 100 MB media limit.\n- `media_fetcher_not_configured`: media can't be fetched from this channel.\n- `media_rejected`: the file is empty or not an allowed media type.\n- `media_integrity_failed`: the stored file failed its integrity check.\n","example":"media_unavailable"},"url":{"type":"string","description":"Short-lived signed download URL. Present only when `ready` is `true`."},"mimeType":{"type":"string","description":"MIME type of the stored file, when `ready` is `true`."},"filename":{"type":"string","description":"Name of the stored file, when `ready` is `true` and the name is known."},"fileSize":{"type":"integer","format":"int64","description":"Size of the stored file in bytes, when `ready` is `true`."}}},"CreateMediaUploadRequest":{"type":"object","description":"Multipart upload body containing the media file to send later.","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"Image, document, video, or audio file to make available for message sending."}}},"MediaUploadResponse":{"type":"object","additionalProperties":false,"description":"Uploaded media reference for message content.","required":["mediaId","mediaType","mimeType","fileSize"],"properties":{"mediaId":{"type":"string","pattern":"^mda_[0-9a-v]{20}$","description":"Handle to pass as `content.media.mediaId` when sending a media message."},"mediaType":{"type":"string","description":"Taken from `mimeType`. Files that aren't images, video or audio are `document`.","enum":["image","document","video","audio"]},"mimeType":{"type":"string"},"filename":{"type":"string"},"fileSize":{"type":"integer","format":"int64"}},"example":{"mediaId":"mda_d7pka1i9v5sfp2ud6chg","mediaType":"document","mimeType":"application/pdf","filename":"invoice-4827.pdf","fileSize":184201}},"ListConversationsResponse":{"type":"object","required":["conversations"],"properties":{"bucketCounts":{"$ref":"#/components/schemas/ConversationBucketCounts"},"conversations":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"nextPageToken":{"type":"string"}}},"ConversationBucketCounts":{"type":"object","description":"Number of conversations the caller can access in each `bucket`, regardless of the\n`bucket`, `mine`, `status` and `ownerType` filters. `mine` counts `open` conversations\nassigned to the caller. Omitted when `skipBucketCounts` is `true` or the request uses\n`search`, `conversationIds` or `interacted`. On later pages the counts can be slightly out\nof date or missing.\n","required":["open","automated","done","mine"],"properties":{"open":{"type":"integer","format":"int64"},"automated":{"type":"integer","format":"int64"},"done":{"type":"integer","format":"int64"},"mine":{"type":"integer","format":"int64"}}},"ConversationDetail":{"allOf":[{"$ref":"#/components/schemas/Conversation"},{"type":"object","required":["serverTime"],"properties":{"automationOutcome":{"type":"object","description":"The latest chatbot outcome recorded in the current session. Present only when the\nsession is assigned to a teammate, unassigned or closed, or while another responder\nholds the conversation (`activeOwner` type `external`).\n","required":["chatbotId","status"],"properties":{"chatbotId":{"type":"string"},"status":{"type":"string","enum":["completed","escalated","failed"]}}},"serverTime":{"type":"string","format":"date-time","description":"Server time when the response was built, for example to compare with\n`messagingWindow.expiresAt`.\n"}}}]},"ListMessagesResponse":{"type":"object","required":["messages","conversation"],"properties":{"conversation":{"$ref":"#/components/schemas/ConversationDetail"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"nextPageToken":{"type":"string"}}},"SendMessageRequest":{"type":"object","description":"Body for replying inside an existing conversation.","required":["content"],"properties":{"expectedContext":{"$ref":"#/components/schemas/InboxActionContext"},"inboxId":{"type":"string","description":"Optional. If set, it must match the conversation's `inboxId`."},"content":{"$ref":"#/components/schemas/OutboundMessageContent"},"contexts":{"type":"array","maxItems":1,"description":"The message this one replies to. It must be in the same conversation.","items":{"$ref":"#/components/schemas/SendMessageContext"}}},"example":{"content":{"type":"text","text":{"body":"Thanks for reaching out. I am checking this now."}}}},"SendReactionRequest":{"type":"object","required":["emoji"],"properties":{"emoji":{"type":"string","description":"The emoji to add or remove."},"removed":{"type":"boolean","default":false,"description":"Set to `true` to remove the caller's reaction with this `emoji`."}}},"SendReactionResponse":{"type":"object","properties":{"reaction":{"$ref":"#/components/schemas/Reaction"}}},"ReassignConversationRequest":{"type":"object","required":["userId"],"properties":{"userId":{"type":"string","description":"ID of the teammate to assign the conversation to."}}},"MarkConversationReadRequest":{"type":"object","required":["lastMessageId"],"properties":{"lastMessageId":{"type":"string","description":"ID of the newest message to mark as read."}}},"CloseConversationRequest":{"type":"object","properties":{"expectedContext":{"$ref":"#/components/schemas/InboxActionContext"}}},"BanConversationRequest":{"type":"object","properties":{"expiresAt":{"type":"string","format":"date-time","description":"When the ban ends; must be in the future. Omit to ban until unbanned."},"reason":{"type":"string","description":"Why the customer is banned; trimmed, at most 500 characters."}}},"CreateContactRequest":{"type":"object","description":"Contact to create. Custom fields must be defined before you can set values for them.","properties":{"name":{"type":"string","maxLength":255},"phone":{"type":"string","maxLength":16,"pattern":"^\\+[1-9]\\d{6,14}$","description":"Phone number in E.164 format, for example `+48123456789`. It is stored as the predefined\n`cf_phone` custom field."},"customFields":{"type":"object","description":"Custom field values keyed by custom field ID (`cf_…`), not by field name. Each ID must\nbe a contact field definition in this workspace; an unknown ID returns 404\n`contacts_customfield_not_found`. Values for `date` fields use `YYYY-MM-DD`. Empty\nvalues are ignored.","additionalProperties":{"type":"string"}}},"example":{"name":"Anna Kowalska","phone":"+48123456789","customFields":{"cf_d7pgooc1v8t53cs68k5g":"lead","cf_d7pgpgin6fdi7ocdmdgg":"Krakow"}}},"Contact":{"type":"object","description":"Customer profile used across messaging, events, and journeys.","required":["id","tenantId","name","createdAt","updatedAt","conversations","tagIds","customFields"],"properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"conversations":{"type":"array","items":{"$ref":"#/components/schemas/ContactConversation"}},"tagIds":{"type":"array","items":{"type":"string"}},"customFields":{"type":"object","description":"Custom field values keyed by custom field ID.","additionalProperties":{"type":"string"}},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"type":"string","format":"date-time","description":"Present only in webhook tombstones for deleted contacts."}},"example":{"id":"con_d7pibvs6gljrc2pfdc1g","tenantId":"tn_d7phk42ge9t9t6324f20","name":"Anna Kowalska","createdAt":"2026-04-30T09:20:00Z","updatedAt":"2026-04-30T10:10:00Z","conversations":[{"conversationId":"cnv_d7pigoip4tfcdebp5mlg","channel":"whatsapp","metadata":{"phone_number":"+48123456789","wa_id":"48123456789"}}],"tagIds":["tag_d7pj8kaicb30377174j0"],"customFields":{"cf_d7pgooc1v8t53cs68k5g":"customer","cf_d7pgpgin6fdi7ocdmdgg":"Krakow"},"archivedAt":null}},"ContactConversation":{"type":"object","description":"Conversation grouped under a contact.","required":["conversationId","channel"],"properties":{"conversationId":{"type":"string"},"channel":{"type":"string","enum":["whatsapp","messenger","instagram"]},"metadata":{"type":"object","description":"Channel identifiers of the customer in this conversation. Keys depend on the channel\nand any key can be missing. WhatsApp conversations can include `phone_number` (E.164,\nwith `+`), `wa_id` (phone digits without `+`), `from`, `user_id`, `parent_user_id`,\nand `username`.\n","additionalProperties":{"type":"string"}}}},"ContactSearchRequest":{"type":"object","additionalProperties":false,"required":["query"],"properties":{"query":{"$ref":"#/components/schemas/ContactFilter"},"orderBy":{"type":"string","enum":["createdAt","createdAt desc","updatedAt","updatedAt desc","name","name desc"],"default":"createdAt desc"},"pageSize":{"type":"integer","minimum":0,"default":50,"description":"Values above 100 are reduced to 100; 0 or omitted uses the default (50)."},"pageToken":{"type":"string","maxLength":4096,"description":"The `nextPageToken` from the previous page."}}},"ContactFilter":{"type":"object","additionalProperties":false,"description":"Conditions that a contact must all match, used by contact searches and saved segments. In\na search, an empty `conditions` array matches every non-archived contact. Each custom field\nID can appear in only one condition. `searchText` is allowed in searches but not in saved\nsegments.\n","required":["match","conditions"],"properties":{"match":{"type":"string","enum":["all"]},"conditions":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/ContactCondition"}}}},"ContactCondition":{"oneOf":[{"$ref":"#/components/schemas/SearchTextCondition"},{"$ref":"#/components/schemas/ArchiveStatusCondition"},{"$ref":"#/components/schemas/CreatedAtCondition"},{"$ref":"#/components/schemas/FirstSeenCondition"},{"$ref":"#/components/schemas/LastInteractionCondition"},{"$ref":"#/components/schemas/ChatCountCondition"},{"$ref":"#/components/schemas/CustomFieldTextCondition"},{"$ref":"#/components/schemas/CustomFieldDateCondition"},{"$ref":"#/components/schemas/HasAnyTagCondition"},{"$ref":"#/components/schemas/HasAnyChannelCondition"}],"discriminator":{"propertyName":"type","mapping":{"searchText":"#/components/schemas/SearchTextCondition","archiveStatus":"#/components/schemas/ArchiveStatusCondition","createdAt":"#/components/schemas/CreatedAtCondition","firstSeen":"#/components/schemas/FirstSeenCondition","lastInteraction":"#/components/schemas/LastInteractionCondition","chatCount":"#/components/schemas/ChatCountCondition","customFieldText":"#/components/schemas/CustomFieldTextCondition","customFieldDate":"#/components/schemas/CustomFieldDateCondition","hasAnyTag":"#/components/schemas/HasAnyTagCondition","hasAnyChannel":"#/components/schemas/HasAnyChannelCondition"}}},"SearchTextCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts whose name, email, or phone number contains `text`, ignoring case. Not\nallowed in saved segments.","required":["type","text"],"properties":{"type":{"type":"string","enum":["searchText"]},"text":{"type":"string","minLength":1,"maxLength":200}}},"ArchiveStatusCondition":{"type":"object","additionalProperties":false,"description":"Selects non-archived (`active`) contacts, `archived` contacts, or `all`. Without this\ncondition, only non-archived contacts match.","required":["type","status"],"properties":{"type":{"type":"string","enum":["archiveStatus"]},"status":{"$ref":"#/components/schemas/ArchiveStatus"}}},"ArchiveStatus":{"type":"string","enum":["active","archived","all"]},"CreatedAtCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts by creation time. `before` uses `end`, `after` uses `start`, and `between`\nuses both (`start` inclusive, `end` exclusive). `olderThanDays` and `newerThanDays` use\n`days`.","required":["type","operator"],"properties":{"type":{"type":"string","enum":["createdAt"]},"operator":{"type":"string","enum":["before","after","between","olderThanDays","newerThanDays"]},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"days":{"type":"integer","minimum":1,"maximum":3650}}},"FirstSeenCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts by the time of their first chat interaction. Operators read `start`, `end`,\nand `days` as in `createdAt`; `exists` and `notExists` take no values.","required":["type","operator"],"properties":{"type":{"type":"string","enum":["firstSeen"]},"operator":{"type":"string","enum":["before","after","between","olderThanDays","newerThanDays","exists","notExists"]},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"days":{"type":"integer","minimum":1,"maximum":3650}}},"LastInteractionCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts by the time of their most recent chat interaction. Operators read `start`,\n`end`, and `days` as in `createdAt`; `exists` and `notExists` take no values.","required":["type","operator"],"properties":{"type":{"type":"string","enum":["lastInteraction"]},"operator":{"type":"string","enum":["before","after","between","olderThanDays","newerThanDays","exists","notExists"]},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"days":{"type":"integer","minimum":1,"maximum":3650}}},"ChatCountCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts by their number of chats in `window`. `atLeast` uses `min`, `atMost` uses\n`max`, and `between` uses both; bounds are inclusive.","required":["type","operator","window"],"properties":{"type":{"type":"string","enum":["chatCount"]},"operator":{"type":"string","enum":["atLeast","atMost","between"]},"min":{"type":"integer","format":"int64","minimum":1},"max":{"type":"integer","format":"int64","minimum":1},"window":{"$ref":"#/components/schemas/EngagementWindow"}}},"EngagementWindow":{"type":"object","additionalProperties":false,"description":"Counts chats over the contact's `lifetime`, or over the last `days` days with `lastDays`.","required":["type"],"properties":{"type":{"type":"string","enum":["lifetime","lastDays"]},"days":{"type":"integer","minimum":1,"maximum":3650}}},"CustomFieldTextCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts by the value of a `text` custom field. `equals` and `notEquals` use\n`value`, and `in` uses `values`. `notEquals` and `in` match only contacts that have a value\nfor the field.","required":["type","fieldId","operator"],"properties":{"type":{"type":"string","enum":["customFieldText"]},"fieldId":{"type":"string","minLength":1},"operator":{"type":"string","enum":["equals","notEquals","in","exists","notExists"]},"value":{"type":"string"},"values":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string"}}}},"CustomFieldDateCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts by the value of a `date` custom field. `start` and `end` are `YYYY-MM-DD`\ndates: `before` uses `end`, `after` uses `start`, and `between` uses both (`start`\ninclusive, `end` exclusive). `olderThanDays` and `newerThanDays` use `days`.","required":["type","fieldId","operator"],"properties":{"type":{"type":"string","enum":["customFieldDate"]},"fieldId":{"type":"string","minLength":1},"operator":{"type":"string","enum":["before","after","between","olderThanDays","newerThanDays","exists","notExists"]},"start":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"days":{"type":"integer","minimum":1,"maximum":3650}}},"HasAnyTagCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts that have at least one of the tags in `tagIds`.","required":["type","tagIds"],"properties":{"type":{"type":"string","enum":["hasAnyTag"]},"tagIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1}}}},"HasAnyChannelCondition":{"type":"object","additionalProperties":false,"description":"Matches contacts with a conversation on at least one of the `channels`.","required":["type","channels"],"properties":{"type":{"type":"string","enum":["hasAnyChannel"]},"channels":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/ContactChannel"}}}},"ContactChannel":{"type":"string","enum":["whatsapp","messenger","instagram","textinc","twilio","genesys"]},"ContactSearchResponse":{"type":"object","additionalProperties":false,"required":["contacts","totalSize","evaluatedAt"],"properties":{"contacts":{"type":"array","items":{"$ref":"#/components/schemas/ContactSummary"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."},"totalSize":{"type":"integer","format":"int64","minimum":0,"description":"Number of matching contacts at `evaluatedAt`. It may be cached for up to five minutes."},"evaluatedAt":{"type":"string","format":"date-time","description":"Time when `totalSize` was calculated."}}},"ContactSummary":{"type":"object","required":["id","name","tags","channels","hasConversations","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/ContactSummaryTag"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/ContactChannel"}},"hasConversations":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"archivedAt":{"type":"string","format":"date-time"}}},"ContactSummaryTag":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"ContactsCountResponse":{"type":"object","required":["totalSize"],"properties":{"totalSize":{"type":"integer","description":"Number of non-archived contacts, or of archived contacts when `archived=true`."}}},"UpdateContactRequest":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"description":"New contact name. Omit the field to leave the name unchanged."}}},"ImportContactsResponse":{"type":"object","description":"Accepted contact import job.","required":["importId"],"properties":{"importId":{"type":"string"}},"example":{"importId":"imp_d7pjdd4valnuhvhh1c8g"}},"ImportStatus":{"type":"object","description":"Progress and results for a contact import.","required":["importId","status","totalRows","successCount","failedCount"],"properties":{"importId":{"type":"string"},"status":{"type":"string","enum":["pending","completed","failed"]},"totalRows":{"type":"integer"},"successCount":{"type":"integer"},"failedCount":{"type":"integer"},"errors":{"type":"array","description":"Row-level failures in row order. An import keeps the first 100; `failedCount` still\ncounts every failed row.","items":{"$ref":"#/components/schemas/ImportError"}},"errorsTruncated":{"type":"boolean","description":"True when more failures occurred than `errors` lists."}},"example":{"importId":"imp_d7pjdd4valnuhvhh1c8g","status":"completed","totalRows":1200,"successCount":1194,"failedCount":6,"errors":[{"row":17,"column":"phone","message":"must be a valid E.164 phone number"}]}},"ImportError":{"type":"object","required":["message"],"properties":{"row":{"type":"integer"},"column":{"type":"string"},"message":{"type":"string"}}},"SetContactCustomFieldValueRequest":{"type":"object","description":"Value to store on a contact. Send an empty string to clear the value.","required":["value"],"properties":{"value":{"type":"string","description":"Field value for this contact."}},"example":{"value":"Krakow"}},"SegmentsResponse":{"type":"object","additionalProperties":false,"required":["segments"],"properties":{"segments":{"type":"array","items":{"$ref":"#/components/schemas/Segment"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."}}},"Segment":{"type":"object","required":["id","name","createdBy","filter","revision","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"createdBy":{"type":"string"},"filter":{"$ref":"#/components/schemas/ContactFilter"},"revision":{"type":"integer","format":"int64","minimum":1,"description":"Increases with every change. The `ETag` combines the segment ID and this number."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateSegmentRequest":{"type":"object","additionalProperties":false,"required":["name","filter"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"filter":{"$ref":"#/components/schemas/ContactFilter"}}},"UpdateSegmentRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"filter":{"$ref":"#/components/schemas/ContactFilter"}}},"ReportsResponse":{"type":"object","required":["reports"],"properties":{"reports":{"type":"array","items":{"$ref":"#/components/schemas/ReportDefinition"}}}},"ReportDefinition":{"type":"object","required":["id","title","description","dataset","grain","dateAnchor","definitionVersion","metrics","dimensions","filters"],"properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"dataset":{"type":"string"},"grain":{"type":"string"},"dateAnchor":{"type":"string"},"definitionVersion":{"type":"string"},"metrics":{"type":"array","items":{"$ref":"#/components/schemas/MetricDefinition"}},"dimensions":{"type":"array","items":{"type":"string"}},"filters":{"type":"array","items":{"type":"string"}}}},"MetricDefinition":{"type":"object","required":["id","label","unit","aggregation"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"unit":{"type":"string","enum":["count","ratio","seconds"]},"aggregation":{"type":"string","enum":["additive","overlapping","ratio","median"]}}},"ReportQuery":{"type":"object","additionalProperties":false,"required":["from","to","timezone"],"properties":{"from":{"type":"string","format":"date-time","description":"Start of the range, inclusive. Must be the start of a day in `timezone`."},"to":{"type":"string","format":"date-time","description":"End of the range, exclusive. Must be the start of a day in `timezone`."},"timezone":{"type":"string","description":"IANA time zone that days and weeks follow, for example `Europe/Warsaw`."},"interval":{"type":"string","enum":["day","week"],"default":"day","description":"Bucket size for rows grouped by `day`. Weekly buckets start on Monday; the first starts\nat `from`.\n"},"groupBy":{"type":"string","description":"One of the report's `dimensions`. Defaults to the report's `grain`."},"population":{"type":"string","enum":["customer","created"],"default":"customer","description":"`created` dates sessions by when they were created instead of by the report's\n`dateAnchor`, and adds the `customer`, `outbound` and `empty` metrics. Only the\n`customer-sessions`, `channels` and `agents` reports support it.\n"},"filters":{"$ref":"#/components/schemas/ReportFilters"},"search":{"type":"string","description":"Supported only by the `agents` report."},"first":{"type":"integer","minimum":1,"maximum":100,"default":50},"after":{"type":"string","maxLength":4096,"description":"`pageInfo.endCursor` from the previous page of the same query."}}},"ReportFilters":{"type":"object","additionalProperties":false,"properties":{"inboxIds":{"type":"array","items":{"type":"string"}},"channels":{"type":"array","items":{"type":"string"}},"agentIds":{"type":"array","items":{"type":"string"}},"botIds":{"type":"array","items":{"type":"string"}},"initiators":{"type":"array","items":{"type":"string"}},"campaignIds":{"type":"array","items":{"type":"string"}}}},"ReportResult":{"type":"object","required":["reportId","definitionVersion","generatedAt","from","to","timezone","interval","dateAnchor","population","filters","columns","rows","totals","comparisonTotals","pageInfo","totalCount"],"properties":{"reportId":{"type":"string"},"definitionVersion":{"type":"string"},"generatedAt":{"type":"string","format":"date-time"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"timezone":{"type":"string"},"interval":{"type":"string"},"dateAnchor":{"type":"string"},"population":{"type":"string"},"filters":{"$ref":"#/components/schemas/ReportFilters"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/ReportColumn"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ReportRow"}},"totals":{"type":"object","description":"Metric totals for the whole range, keyed by metric ID.","additionalProperties":{"$ref":"#/components/schemas/MetricValue"}},"comparisonTotals":{"type":"object","description":"Metric totals for the same number of days just before `from`, keyed by metric ID.","additionalProperties":{"$ref":"#/components/schemas/MetricValue"}},"pageInfo":{"$ref":"#/components/schemas/ReportPageInfo"},"totalCount":{"type":"integer","format":"int64","description":"Number of rows across all pages."}}},"ReportColumn":{"type":"object","required":["id","label","kind"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["dimension","metric"]},"unit":{"type":"string","enum":["count","ratio","seconds"]}}},"ReportRow":{"type":"object","required":["key","dimensions","values"],"properties":{"key":{"type":"string"},"label":{"type":"string"},"bucketStart":{"type":"string","format":"date-time"},"dimensions":{"type":"object","additionalProperties":{"type":"string"}},"values":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/MetricValue"}}}},"MetricValue":{"description":"Metric value. `count` holds exact counts and `number` holds other values, such as ratios.\nNeither is set when the value isn't available.\n","type":"object","properties":{"count":{"type":"integer","format":"int64"},"number":{"type":"number","format":"double"}}},"ReportPageInfo":{"type":"object","required":["hasNextPage"],"properties":{"hasNextPage":{"type":"boolean"},"endCursor":{"type":"string"}}},"CampaignStatus":{"type":"string","enum":["draft","scheduled","sent"]},"CampaignsResponse":{"type":"object","additionalProperties":false,"required":["campaigns"],"properties":{"campaigns":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."}}},"Campaign":{"type":"object","required":["id","name","status","revision","audienceCount","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"$ref":"#/components/schemas/CampaignStatus"},"segmentId":{"type":"string"},"inboxId":{"type":"string"},"channel":{"type":"string","description":"Channel derived from the selected inbox during scheduling."},"content":{"$ref":"#/components/schemas/OutboundMessageContent"},"revision":{"type":"integer","format":"int64"},"scheduledAt":{"type":"string","format":"date-time"},"evaluatedAt":{"type":"string","format":"date-time","description":"When the final audience was taken from the segment."},"sentAt":{"type":"string","format":"date-time"},"audienceCount":{"type":"integer","format":"int32","description":"Number of recipients in the final audience. `0` until the campaign is sent."},"dispatchError":{"type":"string","description":"Code explaining why the campaign was not sent as scheduled. On a draft, it says why dispatch returned the campaign to draft (for example `messaging_limit_exceeded`); on a sent campaign, why sending stopped early (for example `provider_restricted`)."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateCampaignRequest":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":200}}},"UpdateCampaignRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","minLength":1,"maxLength":200},"segmentId":{"type":"string"},"inboxId":{"type":"string"},"content":{"anyOf":[{"$ref":"#/components/schemas/OutboundMessageContent"},{"type":"null"}]}}},"ScheduleCampaignRequest":{"type":"object","additionalProperties":false,"required":["sendAt"],"properties":{"sendAt":{"type":"string","description":"`now`, or an RFC 3339 timestamp in the future."}}},"CampaignRecipientStatus":{"type":"string","enum":["pending","unknown","sent","delivered","read","failed"]},"CampaignRecipientsResponse":{"type":"object","additionalProperties":false,"required":["campaignRecipients"],"properties":{"campaignRecipients":{"type":"array","items":{"$ref":"#/components/schemas/CampaignRecipient"}},"nextPageToken":{"type":"string","description":"Token to pass as `pageToken` for the next page. Omitted on the last page."}}},"CampaignRecipient":{"type":"object","required":["id","snapshot","status"],"properties":{"id":{"type":"string"},"contactId":{"type":"string","description":"Omitted when the contact has been deleted."},"snapshot":{"$ref":"#/components/schemas/CampaignRecipientSnapshot"},"status":{"$ref":"#/components/schemas/CampaignRecipientStatus"},"messageId":{"type":"string"},"sentAt":{"type":"string","format":"date-time"},"deliveredAt":{"type":"string","format":"date-time"},"readAt":{"type":"string","format":"date-time"},"failedAt":{"type":"string","format":"date-time"},"failureCode":{"type":"string"}}},"CampaignRecipientSnapshot":{"type":"object","description":"Contact name and identifiers captured when the final audience was taken. Emptied when the\ncontact is deleted.","required":["identifiers"],"properties":{"name":{"type":"string"},"identifiers":{"type":"object","description":"Recipient identifiers, such as `phoneNumber` or `businessScopedUserId`.","additionalProperties":{"type":"string"}}}},"CampaignAnalytics":{"type":"object","description":"`pending` to `failed` count recipients by their current status. The `*Stage` fields count\nrecipients that ever reached that stage, so a read message also counts in `sentStage` and\n`deliveredStage`.","required":["audienceCount","pending","unknown","sent","delivered","read","failed","sentStage","deliveredStage","readStage","failedStage"],"properties":{"audienceCount":{"type":"integer","format":"int64","description":"Number of recipients in the final audience."},"pending":{"type":"integer","format":"int64"},"unknown":{"type":"integer","format":"int64"},"sent":{"type":"integer","format":"int64"},"delivered":{"type":"integer","format":"int64"},"read":{"type":"integer","format":"int64"},"failed":{"type":"integer","format":"int64"},"sentStage":{"type":"integer","format":"int64"},"deliveredStage":{"type":"integer","format":"int64"},"readStage":{"type":"integer","format":"int64"},"failedStage":{"type":"integer","format":"int64"},"deliveryRate":{"type":"number","format":"double","description":"`deliveredStage` divided by `sentStage`. Omitted while `sentStage` is `0`."},"readRate":{"type":"number","format":"double","description":"`readStage` divided by `deliveredStage`. Omitted while `deliveredStage` is `0`."}}},"TagsResponse":{"type":"object","required":["tags"],"properties":{"tags":{"type":"array","items":{"$ref":"#/components/schemas/Tag"}}}},"Tag":{"type":"object","description":"Label used to segment and organize contacts.","required":["id","name","createdAt","createdBy","labeledCount"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"labeledCount":{"type":"integer","description":"Number of contacts with this tag, including archived contacts."}}},"CreateTagRequest":{"type":"object","description":"Tag to create.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50}},"example":{"name":"VIP"}},"CustomFieldDefinitionsResponse":{"type":"object","description":"Custom field definitions for contacts or for property records, depending on the path.","required":["customFields"],"properties":{"customFields":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldDefinition"}}}},"CustomFieldDefinition":{"type":"object","description":"Defines a reusable custom field for either contacts or property records. Values are stored\nseparately on each contact or property record.\n","required":["id","name","type","createdAt","createdBy","predefined","entityType"],"properties":{"id":{"type":"string","description":"Stable custom field definition ID."},"name":{"type":"string","description":"Human-readable label shown to teammates and API clients."},"type":{"type":"string","description":"Value type accepted by this custom field.","enum":["text","date"]},"createdAt":{"type":"string","format":"date-time","description":"When the field definition was created."},"createdBy":{"type":"string","description":"User ID that created the field definition."},"predefined":{"type":"boolean","description":"True for Flownally-managed fields that cannot be renamed or deleted."},"entityType":{"type":"string","description":"Record type this field applies to.","enum":["contact","property"]}},"example":{"id":"cf_d7pk58tlq90js01eokv0","name":"Region","type":"text","createdAt":"2026-04-30T09:00:00Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","predefined":false,"entityType":"property"}},"CreateCustomFieldDefinitionRequest":{"type":"object","description":"Field definition to create. The path decides whether it applies to contacts or property\nrecords.","required":["name","type"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50,"description":"Human-readable label for the field."},"type":{"type":"string","description":"Value type accepted by the field.","enum":["text","date"]}},"example":{"name":"Region","type":"text"}},"UpdateCustomFieldDefinitionRequest":{"type":"object","description":"New name for an existing field definition.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50,"description":"Human-readable label for the field."}},"example":{"name":"Region"}},"JourneysResponse":{"type":"object","required":["journeys"],"properties":{"journeys":{"type":"array","items":{"$ref":"#/components/schemas/Journey"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"Journey":{"type":"object","description":"Automated flow, built in the Flownally flow editor, that starts a run for a contact when its\ntrigger matches. `definition`, `triggerConfig` and `entryMode` hold the draft;\n`activeVersion` is the version new runs use.\n","required":["id","tenantId","name","status","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"status":{"$ref":"#/components/schemas/JourneyStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"definition":{"$ref":"#/components/schemas/WorkflowDefinition"},"triggerConfig":{"$ref":"#/components/schemas/TriggerConfig"},"activeVersion":{"$ref":"#/components/schemas/JourneyVersion"},"entryMode":{"$ref":"#/components/schemas/EntryMode"}},"example":{"id":"jrn_d7pjrnc16v39v3b6dsk0","tenantId":"tn_d7phk42ge9t9t6324f20","name":"Post-purchase follow-up","status":"draft","createdAt":"2026-04-30T09:55:00Z","updatedAt":"2026-04-30T10:05:00Z","entryMode":"once"}},"JourneyStatus":{"type":"string","description":"`draft`: never published. `active`: a version is active and new runs start. `paused`:\npublished, but no version is active.\n","enum":["draft","active","paused"]},"WorkflowDefinition":{"type":"object","x-ogen-name":"WorkflowDefinition","properties":{"nodes":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowNode"}},"edges":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowEdge"}}}},"WorkflowNode":{"x-ogen-name":"WorkflowNode","oneOf":[{"$ref":"#/components/schemas/StartWorkflowNode"},{"$ref":"#/components/schemas/HTTPRequestWorkflowNode"},{"$ref":"#/components/schemas/SplitByMessageStatusWorkflowNode"},{"$ref":"#/components/schemas/WaitForMessageStatusWorkflowNode"},{"$ref":"#/components/schemas/GenericWorkflowNode"}],"discriminator":{"propertyName":"type","mapping":{"start":"#/components/schemas/StartWorkflowNode","send_http_request":"#/components/schemas/HTTPRequestWorkflowNode","http_request":"#/components/schemas/HTTPRequestWorkflowNode","split_by_message_status":"#/components/schemas/SplitByMessageStatusWorkflowNode","wait_for_message_status":"#/components/schemas/WaitForMessageStatusWorkflowNode","end":"#/components/schemas/GenericWorkflowNode","send_message":"#/components/schemas/GenericWorkflowNode","update_tags":"#/components/schemas/GenericWorkflowNode","wait":"#/components/schemas/GenericWorkflowNode","wait_until":"#/components/schemas/GenericWorkflowNode","wait_for_event":"#/components/schemas/GenericWorkflowNode","promise":"#/components/schemas/GenericWorkflowNode","split_by_condition":"#/components/schemas/GenericWorkflowNode","condition":"#/components/schemas/GenericWorkflowNode"}}},"StartWorkflowNode":{"type":"object","required":["id","type","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["start"]},"data":{"$ref":"#/components/schemas/StartNodeData"}}},"StartNodeData":{"type":"object","description":"Settings of the journey's start node. What starts a run, and how often, comes from the\njourney's top-level `triggerConfig` and `entryMode`, not from these fields.\n","properties":{"label":{"type":"string","description":"Node name shown in the flow editor."},"triggerConfig":{"$ref":"#/components/schemas/TriggerConfig"},"entryMode":{"$ref":"#/components/schemas/EntryMode"}}},"TriggerConfig":{"type":"object","x-ogen-name":"TriggerConfig","description":"What starts a run of the journey for a contact.","properties":{"type":{"type":"string","description":"`contact_created`: a contact is created. `contact_updated`: a contact changes.\n`event`: an event is recorded for a contact, including conversations starting and\nending. `instagram_comment`: someone comments on Instagram media of `inboxId`.\n","enum":["contact_created","contact_updated","event","instagram_comment"]},"inboxId":{"type":"string","description":"Instagram inbox to watch. Required for `instagram_comment` and used only by it."},"mediaTypes":{"type":"array","description":"Instagram media types to watch. Omit to watch posts and reels. Stories can't receive comments (a story reply arrives as a direct message), so `story` never matches; it stays accepted so older journeys remain valid.","items":{"type":"string","enum":["post","reel","story"]}},"mediaSelection":{"type":"string","description":"`all` (the default) watches every matching media; `specific` watches only `mediaIds`.","enum":["all","specific"]},"mediaIds":{"type":"array","description":"Instagram media to watch. Required when `mediaSelection` is `specific`, and not allowed\notherwise.\n","items":{"type":"string"}},"conditions":{"type":"object","description":"Filters for `contact_updated` and `event` triggers. `instagram_comment` doesn't accept\nthem.\n","properties":{"changedPaths":{"type":"array","description":"For `contact_updated`: start only when a changed path equals one of these or is\nnested under it, such as `name`, `customFields.<fieldId>` or `tags.<tagId>.added`.\nOmit to start on every update.\n","items":{"type":"string"}},"eventTypeIds":{"type":"array","description":"For `event`: start only for events of these event types. Omit to start on every\nevent. Conversations starting and ending use `evt-type-conversation-started` and\n`evt-type-conversation-ended`.\n","items":{"type":"string"}},"openedBy":{"type":"array","description":"For conversations starting and ending: start only when the conversation was opened\nby one of these. Omit to match every opener except `journey`; list `journey`\nexplicitly to include conversations a journey opened. Ignored for other event types.\n","items":{"type":"string","enum":["customer","user","journey","bot","unknown"]}}}}}},"EntryMode":{"type":"string","enum":["once","repeatable","concurrent"],"default":"once","description":"How often a contact can enter the journey. `once`: at most once, ever. `repeatable`: again\nafter their previous run ends. `concurrent`: on every matching trigger, even while earlier\nruns are still in progress.\n"},"HTTPRequestWorkflowNode":{"type":"object","required":["id","type","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","description":"`http_request` is the older name, still accepted and returned for journeys saved with it.","enum":["send_http_request","http_request"]},"data":{"$ref":"#/components/schemas/HTTPRequestNodeData"}}},"HTTPRequestNodeData":{"type":"object","required":["url"],"properties":{"label":{"type":"string","description":"Node name shown in the flow editor."},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"],"default":"POST"},"url":{"type":"string","description":"URL to call. Must use `https`. Template expressions can fill the path, query and fragment, but not the scheme or host, and not secrets."},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Request headers. Values can contain template expressions. A header can use a workspace\nsecret only as its whole value, written `{{ secrets.NAME }}`. Saving, publishing or\nactivating a journey that sends a secret requires the `journey:use_secrets` permission.\n"},"bodyType":{"type":"string","description":"Defaults to `json` when `body` is set, otherwise `none`.","enum":["json","none"]},"body":{"description":"JSON body to send. Strings in it can contain template expressions, but not secrets.\nRequired when `bodyType` is `json`, and not allowed when it is `none`.\n","additionalProperties":true},"timeoutSeconds":{"type":"integer","description":"How long each attempt can take, in seconds.","minimum":1,"maximum":60,"example":15}}},"SplitByMessageStatusWorkflowNode":{"type":"object","required":["id","type","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["split_by_message_status"]},"data":{"$ref":"#/components/schemas/SplitByMessageStatusNodeData"}}},"SplitByMessageStatusNodeData":{"type":"object","description":"Continues on the `true` edge when the message reached the status, otherwise on `false`.\nA failed message, or one the journey didn't send on this path, takes `false`.\n","required":["messageNodeId","status"],"properties":{"label":{"type":"string","description":"Node name shown in the flow editor."},"messageNodeId":{"type":"string","description":"ID of an earlier `send_message` node in this journey."},"status":{"$ref":"#/components/schemas/JourneyMessageStatus"}}},"JourneyMessageStatus":{"type":"string","description":"How far the contact got with a message the journey sent. Each status includes the ones before it:\n`replied` counts as `read`, and `read` counts as `delivered`. `replied` means any customer message\nin that conversation after the journey's message.\n","enum":["delivered","read","replied"]},"WaitForMessageStatusWorkflowNode":{"type":"object","required":["id","type","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["wait_for_message_status"]},"data":{"$ref":"#/components/schemas/WaitForMessageStatusNodeData"}}},"WaitForMessageStatusNodeData":{"type":"object","description":"Continues on the `signal` edge once the message reaches the status, or on `timeout` when the timeout passes\nfirst. A failed message, or one the journey didn't send on this path, takes `timeout` at once.\n","required":["messageNodeId","status","timeout"],"properties":{"label":{"type":"string","description":"Node name shown in the flow editor."},"messageNodeId":{"type":"string","description":"ID of an earlier `send_message` node in this journey."},"status":{"$ref":"#/components/schemas/JourneyMessageStatus"},"timeout":{"type":"string","description":"How long to wait, counted from when the wait starts, as a positive duration such as\n`1440m` or `24h`.\n","example":"1440m"}}},"GenericWorkflowNode":{"type":"object","required":["id","type","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["end","send_message","update_tags","wait","wait_until","wait_for_event","promise","split_by_condition","condition"]},"data":{"$ref":"#/components/schemas/GenericNodeData"}}},"GenericNodeData":{"type":"object","description":"Settings for node types this reference doesn't describe in detail.","additionalProperties":true},"WorkflowEdge":{"$ref":"#/components/schemas/WorkflowEdge2"},"WorkflowEdge2":{"type":"object","x-ogen-name":"WorkflowEdge","required":["id","source","target"],"properties":{"id":{"type":"string"},"source":{"type":"string"},"target":{"type":"string"},"sourceHandle":{"type":"string","description":"Output of the source node this edge leaves from, such as `true`, `false` or `timeout`."},"value":{"type":"string","description":"Value that selects this edge among edges with the same `sourceHandle`, for example the\nvalue of the button a customer picked in a `send_rich_message` node.\n"},"targetHandle":{"type":"string"},"data":{"type":"object","additionalProperties":true,"description":"Extra edge data, for example labels or jump markers."}}},"JourneyVersion":{"type":"object","description":"Published, read-only copy of a journey's draft.","required":["id","journeyId","createdAt"],"properties":{"id":{"type":"string"},"journeyId":{"type":"string"},"definition":{"$ref":"#/components/schemas/WorkflowDefinition"},"triggerConfig":{"$ref":"#/components/schemas/TriggerConfig"},"entryMode":{"$ref":"#/components/schemas/EntryMode"},"createdAt":{"type":"string","format":"date-time"},"firstActivatedAt":{"description":"When the version was first activated. Omitted if it never was, or if it was last active\nbefore Flownally started recording this.\n","type":"string","format":"date-time"},"deactivatedAt":{"description":"When the version last stopped taking new runs. Omitted while it is active, if it never\nwas, or if it stopped before Flownally started recording this.\n","type":"string","format":"date-time"}}},"CreateJourneyRequest":{"type":"object","description":"Journey draft to create.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"definition":{"$ref":"#/components/schemas/WorkflowDefinition"},"triggerConfig":{"$ref":"#/components/schemas/TriggerConfig"},"entryMode":{"$ref":"#/components/schemas/EntryMode"}},"example":{"name":"Post-purchase follow-up","entryMode":"once"}},"UpdateJourneyRequest":{"type":"object","description":"Journey draft fields to update.","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"definition":{"$ref":"#/components/schemas/WorkflowDefinition"},"triggerConfig":{"$ref":"#/components/schemas/TriggerConfig"},"entryMode":{"$ref":"#/components/schemas/EntryMode"}}},"JourneyVersionsResponse":{"type":"object","required":["journeyVersions"],"properties":{"journeyVersions":{"type":"array","items":{"$ref":"#/components/schemas/JourneyVersion"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"JourneyStats":{"type":"object","required":["runningNow","entered","nodes"],"properties":{"runningNow":{"type":"integer","description":"Running runs of the requested version, or of every version, whenever they entered."},"entered":{"$ref":"#/components/schemas/JourneyEntryCounts"},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/JourneyNodeStats"}}}},"JourneyEntryCounts":{"type":"object","description":"Runs that entered in the range, including runs of contacts deleted since, which the `journeys` report leaves out.","required":["runs","contacts","running","completed","failed","untracked"],"properties":{"runs":{"type":"integer"},"contacts":{"type":"integer","description":"Distinct contacts among the runs."},"running":{"type":"integer"},"completed":{"type":"integer"},"failed":{"type":"integer"},"untracked":{"type":"integer","description":"Runs with no recorded node, which started before nodes were recorded or failed before reaching their first node."}}},"JourneyNodeStats":{"type":"object","description":"Visits to a node by runs that entered in the range. Each visit left by an edge,\nis still on the node, completed on it or failed on it, and `reached` is their\nsum. A run that loops back visits the node again.\n","required":["nodeId","reached","running","completed","failed","edges"],"properties":{"nodeId":{"type":"string"},"reached":{"type":"integer"},"running":{"type":"integer"},"completed":{"type":"integer"},"failed":{"type":"integer"},"edges":{"type":"array","items":{"$ref":"#/components/schemas/JourneyEdgeStats"}}}},"JourneyEdgeStats":{"type":"object","description":"How many times runs left a node by one of its edges.","required":["handle","nextNodeId","count"],"properties":{"handle":{"type":"string","description":"The edge's source handle, such as `true`, `false` or `timeout`; empty for a node with one output."},"nextNodeId":{"type":"string"},"count":{"type":"integer"}}},"JourneyRunStatus":{"type":"string","description":"New end states may be added.","enum":["running","completed","failed"]},"JourneyRunsResponse":{"type":"object","required":["journeyRuns"],"properties":{"journeyRuns":{"type":"array","items":{"$ref":"#/components/schemas/JourneyRun"}},"nextPageToken":{"type":"string"}}},"JourneyRun":{"type":"object","required":["id","contact","status","enteredAt"],"properties":{"id":{"type":"string"},"contact":{"$ref":"#/components/schemas/JourneyRunContact"},"versionId":{"type":"string","description":"Omitted for older runs that started before runs recorded their version."},"status":{"$ref":"#/components/schemas/JourneyRunStatus"},"currentNodeId":{"type":"string","description":"The node the run is on, or completed or failed on. Omitted until the run leaves its\nfirst node.\n"},"currentNodeSince":{"type":"string","format":"date-time"},"enteredAt":{"type":"string","format":"date-time"}}},"JourneyRunContact":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"}}},"ChatbotsResponse":{"type":"object","required":["chatbots"],"properties":{"chatbots":{"type":"array","items":{"$ref":"#/components/schemas/Chatbot"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"Chatbot":{"type":"object","description":"Automated conversation flow, built in the Flownally flow editor, that serves selected teams\nor the whole workspace. `draft` holds unpublished changes; `activeVersion` is the version\nin use.\n","required":["id","name","status","teamIds","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"$ref":"#/components/schemas/ChatbotStatus"},"teamIds":{"type":"array","description":"Teams this chatbot serves. An empty array makes it the workspace-wide chatbot, which\nserves conversations whose team has no active chatbot of its own, and conversations\nwithout a team. At most one active chatbot serves each team, and at most one active\nchatbot is workspace-wide.\n","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"draft":{"$ref":"#/components/schemas/ChatbotsWorkflowDefinition"},"activeVersion":{"$ref":"#/components/schemas/ChatbotVersion"}},"example":{"id":"cbt_d7piv2pmo0bkvp4lmeh0","name":"Support triage","status":"draft","teamIds":["tem_d7pi77577990sq67vgqg"],"createdAt":"2026-04-30T10:00:00Z","updatedAt":"2026-04-30T10:12:00Z"}},"ChatbotStatus":{"type":"string","description":"`draft`: never published. `active`: a version is active and the chatbot serves. `paused`:\npublished, but no version is active.\n","enum":["draft","active","paused"]},"ChatbotsWorkflowDefinition":{"type":"object","x-ogen-name":"ChatbotWorkflowDefinition","properties":{"nodes":{"type":"array","items":{"$ref":"#/components/schemas/ChatbotsWorkflowNode"}},"edges":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowEdge2"}}}},"ChatbotsWorkflowNode":{"type":"object","x-ogen-name":"ChatbotWorkflowNode","required":["id","type","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","minLength":1,"description":"Node type, such as `send_http_request`."},"data":{"type":"object","description":"Node settings, which depend on `type`. `send_http_request` nodes use\n`HTTPRequestNodeData`.\n","additionalProperties":true}}},"ChatbotVersion":{"type":"object","description":"Published, read-only copy of a chatbot's draft.","required":["id","chatbotId","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"chatbotId":{"type":"string"},"definition":{"$ref":"#/components/schemas/ChatbotsWorkflowDefinition"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateChatbotRequest":{"type":"object","description":"Chatbot draft to create.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"teamIds":{"type":"array","description":"Teams the chatbot serves. Omit or leave empty to make it the workspace-wide chatbot.","items":{"type":"string"}},"draft":{"$ref":"#/components/schemas/ChatbotsWorkflowDefinition"}},"example":{"name":"Support triage","teamIds":["tem_d7pi77577990sq67vgqg"]}},"UpdateChatbotRequest":{"type":"object","description":"Chatbot draft fields to update.","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"teamIds":{"type":"array","description":"Replaces all of the chatbot's teams. Omit to keep them; pass an empty array to make it\nthe workspace-wide chatbot.\n","items":{"type":"string"}},"draft":{"$ref":"#/components/schemas/ChatbotsWorkflowDefinition"}}},"ChatbotVersionsResponse":{"type":"object","required":["chatbotVersions"],"properties":{"chatbotVersions":{"type":"array","items":{"$ref":"#/components/schemas/ChatbotVersion"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"EventTypesResponse":{"type":"object","description":"Event type catalog.","required":["eventTypes"],"properties":{"eventTypes":{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"EventType":{"type":"object","description":"Kind of event you can record for contacts, such as `order.paid`. Predefined event types,\nsuch as `conversation_started`, have no `tenantId`.\n","required":["id","name","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"tenantId":{"type":"string","description":"Workspace that created the event type. Omitted for predefined event types."},"name":{"type":"string"},"description":{"type":"string"},"payloadSchema":{"type":"object","description":"Expected payload fields of events of this type, keyed by field name. See\n`CreateEventTypeRequest` for the format.\n","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"example":{"id":"ety_d7pji5t0tajnmqt4a2rg","tenantId":"tn_d7phk42ge9t9t6324f20","name":"order.paid","description":"Customer paid for an order.","payloadSchema":{"orderId":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string","required":false}},"createdAt":"2026-04-30T09:30:00Z","updatedAt":"2026-04-30T09:30:00Z"}},"CreateEventTypeRequest":{"type":"object","description":"Event type to add to the workspace catalog.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"payloadSchema":{"type":"object","description":"Expected payload fields of events of this type, keyed by field name. This is a\nsimplified format, not a full JSON Schema. Each field is an object with:\n\n- `type` (required): `string`, `number`, `integer`, `boolean` or `null`.\n- `format`: `date` or `date-time`, for `string` fields only.\n- `nullable`: `true` to also accept `null`.\n- `required`: `false` to make the field optional. Fields are required by default.\n\nPayload fields not listed here are accepted.\n","additionalProperties":true}},"example":{"name":"order.paid","description":"Customer paid for an order.","payloadSchema":{"orderId":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string","required":false}}}},"UpdateEventTypeRequest":{"type":"object","description":"Event type fields to update.","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"payloadSchema":{"type":"object","description":"Replaces the payload schema, in the same format as on create. It must keep every field\nof the current schema.\n","additionalProperties":true}}},"EventsResponse":{"type":"object","description":"Paginated recorded events.","required":["events"],"properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"nextPageToken":{"type":"string"},"totalSize":{"type":"integer"}}},"Event":{"type":"object","description":"Event recorded for a contact.","required":["id","tenantId","contactId","eventTypeId","eventTypeName","createdAt"],"properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"contactId":{"type":"string"},"eventTypeId":{"type":"string"},"eventTypeName":{"type":"string"},"payload":{"type":"object","additionalProperties":true},"idempotencyKey":{"type":"string","maxLength":255},"createdAt":{"type":"string","format":"date-time"}},"example":{"id":"evt_d7pjmuk9lfdk4tgvlnpg","tenantId":"tn_d7phk42ge9t9t6324f20","contactId":"con_d7pibvs6gljrc2pfdc1g","eventTypeId":"ety_d7pji5t0tajnmqt4a2rg","eventTypeName":"order.paid","payload":{"orderId":"4827","total":129.99,"currency":"PLN"},"idempotencyKey":"order-4827-paid","createdAt":"2026-04-30T10:40:00Z"}},"CreateEventRequest":{"type":"object","description":"Body of the deprecated `POST /events`, which takes the contact ID in the body.","required":["contactId","eventTypeName"],"properties":{"contactId":{"type":"string"},"eventTypeName":{"type":"string"},"payload":{"type":"object","additionalProperties":true},"idempotencyKey":{"type":"string","description":"Same as the `Idempotency-Key` header. When both are sent, the header wins.","maxLength":255}},"example":{"contactId":"con_d7pibvs6gljrc2pfdc1g","eventTypeName":"order.paid","payload":{"orderId":"4827","total":129.99,"currency":"PLN"},"idempotencyKey":"order-4827-paid"}},"CreateContactEventRequest":{"type":"object","description":"Event to record for the contact in the path.","required":["name"],"properties":{"name":{"type":"string","description":"Name of the event type, for example `order.paid`."},"payload":{"type":"object","additionalProperties":true},"idempotencyKey":{"type":"string","description":"Same as the `Idempotency-Key` header. When both are sent, the header wins.","maxLength":255}},"example":{"name":"order.paid","payload":{"orderId":"4827","total":129.99,"currency":"PLN"},"idempotencyKey":"order-4827-paid"}},"BillingStatusResponse":{"type":"object","description":"Current subscription state for the workspace.","required":["status","active","cancelAtPeriodEnd","paymentIssue","trialAvailable","acquisition"],"properties":{"trial":{"$ref":"#/components/schemas/BillingTrial"},"status":{"type":"string","description":"Deprecated. Billing status. One of: unpaid, initializing, trial_pending, provisioning, manual_access, trialing, active, past_due, paused, incomplete, incomplete_expired, canceled."},"active":{"type":"boolean","description":"Deprecated. Whether the workspace may use the product right now."},"plan":{"type":"string","description":"Current plan name."},"cancelAtPeriodEnd":{"type":"boolean","description":"True when the subscription is scheduled to cancel at the end of the current billing period. The subscription is still active until cancelAt; after that date it transitions to canceled."},"cancelAt":{"type":"string","format":"date-time","description":"When access ends if a cancellation is scheduled. Absent when the subscription is not scheduled to cancel."},"trialEndsAt":{"type":"string","format":"date-time","description":"Deprecated: use `trial.endsAt`. When the trial ends. Present only when `status` is `trialing`."},"paymentIssue":{"type":"boolean","description":"True when the subscription has a payment problem (`past_due`, `unpaid`, `paused`, `incomplete` or `incomplete_expired`). The workspace Owner needs to update the payment method."},"trialAvailable":{"type":"boolean","description":"Whether the no-card trial can still be started for this workspace."},"acquisition":{"$ref":"#/components/schemas/BillingAcquisition"},"subscription":{"$ref":"#/components/schemas/BillingSubscription"}},"example":{"status":"active","active":true,"plan":"professional","cancelAtPeriodEnd":false,"paymentIssue":false,"trialAvailable":false,"acquisition":{"mode":"catalog"},"subscription":{"currentPeriodStart":"2026-10-03T09:00:00Z","currentPeriodEnd":"2026-11-03T09:00:00Z","terms":{"productName":"Professional","base":{"currency":"usd","unitAmount":19900,"interval":"monthly"},"overage":{"includedQuantity":1000,"unitAmount":10,"interval":"monthly"}},"usage":{"periodStart":"2026-10-01T00:00:00Z","periodEnd":"2026-11-01T00:00:00Z","activeContacts":1200,"overageContacts":200,"overageAmount":2000}}}},"BillingTrial":{"type":"object","description":"The no-card trial, present once it has started.","required":["state","endsAt","contactsUsed","contactsLimit"],"properties":{"state":{"type":"string","enum":["running","ended"]},"endsAt":{"type":"string","format":"date-time","description":"When the trial ends if the contact limit is not reached first."},"contactsUsed":{"type":"integer","format":"int32","minimum":0,"description":"Distinct active contacts reached since the trial started."},"contactsLimit":{"type":"integer","format":"int32","minimum":1,"description":"Active contacts the trial includes."},"endReason":{"type":"string","enum":["expired","contacts_limit","converted"]}}},"BillingAcquisition":{"description":"The checkout path currently available to the workspace. Assigned-offer details are present only when mode is assigned_offer. Unavailable means the assigned offer could not be safely resolved and checkout must remain disabled until status is refreshed.","oneOf":[{"$ref":"#/components/schemas/CatalogBillingAcquisition"},{"$ref":"#/components/schemas/AssignedOfferBillingAcquisition"},{"$ref":"#/components/schemas/UnavailableBillingAcquisition"}],"discriminator":{"propertyName":"mode","mapping":{"catalog":"#/components/schemas/CatalogBillingAcquisition","assigned_offer":"#/components/schemas/AssignedOfferBillingAcquisition","unavailable":"#/components/schemas/UnavailableBillingAcquisition"}}},"CatalogBillingAcquisition":{"type":"object","additionalProperties":false,"required":["mode"],"properties":{"mode":{"type":"string","enum":["catalog"]},"plans":{"type":"array","description":"What each catalog plan charges, one entry per plan and billing interval. Absent when the plans' prices can't be read; checkout still works.","items":{"$ref":"#/components/schemas/BillingCatalogPlan"}}}},"BillingCatalogPlan":{"type":"object","additionalProperties":false,"required":["plan","terms"],"properties":{"plan":{"type":"string","minLength":1,"pattern":".*\\S.*","description":"Catalog plan ID, as checkout takes it.","example":"professional"},"terms":{"$ref":"#/components/schemas/BillingPlanTerms"}}},"BillingPlanTerms":{"type":"object","description":"What a plan charges.","required":["productName","base","overage"],"properties":{"productName":{"type":"string","minLength":1,"pattern":".*\\S.*","description":"Customer-facing plan name."},"base":{"$ref":"#/components/schemas/BillingPlanBase"},"overage":{"$ref":"#/components/schemas/BillingPlanOverage"}}},"BillingPlanBase":{"type":"object","additionalProperties":false,"description":"The plan's recurring base price.","required":["currency","unitAmount","interval","billingCycle"],"properties":{"currency":{"type":"string","enum":["usd"],"description":"Lowercase ISO 4217 currency code."},"unitAmount":{"type":"integer","format":"int64","minimum":1,"description":"Base amount in the currency's minor unit."},"interval":{"type":"string","enum":["monthly","annually","custom"],"description":"Monthly or annually for the catalog's cycles, custom for any other cycle; billingCycle is the exact cycle."},"billingCycle":{"$ref":"#/components/schemas/BillingCycle"}}},"BillingCycle":{"type":"object","additionalProperties":false,"description":"How often the base price bills, for example every 15 days.","required":["unit","count"],"properties":{"unit":{"type":"string","enum":["day","week","month","year"]},"count":{"type":"integer","minimum":1,"description":"Units in one cycle."}}},"BillingPlanOverage":{"type":"object","additionalProperties":false,"description":"Active contacts the base price includes, and the price of each one beyond them per usage month.","required":["includedQuantity","unitAmount","interval"],"properties":{"includedQuantity":{"type":"integer","format":"int64","minimum":1,"description":"Quantity included in the recurring base price."},"unitAmount":{"type":"integer","format":"int64","minimum":1,"description":"Per-unit overage amount in the base currency's minor unit."},"interval":{"type":"string","enum":["monthly"]},"pooled":{"type":"boolean","description":"Set when the base's billing cycle is two months or longer: its months pool includedQuantity a month into one allowance over the cycle, usable in any of them."}}},"AssignedOfferBillingAcquisition":{"type":"object","additionalProperties":false,"required":["mode","key","revision","plan","productName","base","overage"],"properties":{"mode":{"type":"string","enum":["assigned_offer"]},"key":{"type":"string","minLength":1,"pattern":".*\\S.*","description":"The assigned offer's ID. Equals revision, because offers are never updated."},"revision":{"type":"string","minLength":1,"pattern":".*\\S.*","description":"Opaque assigned-offer revision required to start Checkout."},"plan":{"type":"string","enum":["custom"],"description":"Plan granted by the assigned offer."},"productName":{"type":"string","minLength":1,"pattern":".*\\S.*","description":"Customer-facing assigned-offer name."},"base":{"$ref":"#/components/schemas/BillingPlanBase"},"overage":{"$ref":"#/components/schemas/BillingPlanOverage"}}},"UnavailableBillingAcquisition":{"type":"object","additionalProperties":false,"required":["mode"],"properties":{"mode":{"type":"string","enum":["unavailable"]}}},"BillingSubscription":{"type":"object","description":"The current subscription's billing period, what it charges and its usage month so far. Terms are absent when the subscription's price can't be read.","required":["currentPeriodStart","currentPeriodEnd"],"properties":{"currentPeriodStart":{"type":"string","format":"date-time"},"currentPeriodEnd":{"type":"string","format":"date-time","description":"When the base price renews, or when access ends if cancelAt is set."},"terms":{"$ref":"#/components/schemas/BillingPlanTerms"},"usage":{"$ref":"#/components/schemas/BillingUsage"}}},"BillingUsage":{"type":"object","description":"Active contacts counted so far in the usage month that overage is charged for. Usage months follow the subscription's billing: renewal to renewal for a monthly plan, whole shorter cycles adding up to about 30 days, or months counted from the start of a longer period. They run between UTC midnights; periodEnd is when usage resets. Present with terms once the month has been counted.","required":["periodStart","periodEnd","activeContacts","overageContacts","overageAmount"],"properties":{"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"activeContacts":{"type":"integer","format":"int64","minimum":0},"overageContacts":{"type":"integer","format":"int64","minimum":0,"description":"Active contacts beyond overage.includedQuantity, each charged overage.unitAmount."},"overageAmount":{"type":"integer","format":"int64","minimum":0,"description":"What the overage contacts cost so far, in the base currency's minor unit."},"allowance":{"$ref":"#/components/schemas/BillingUsageAllowance"}}},"BillingUsageAllowance":{"type":"object","description":"The allowance the usage months of a billing period of two months or more pool, such as a year: overage.includedQuantity a month for each month of the period. Overage starts once the period has used it up. After a plan change the new plan's allowance pools from the next usage month.","required":["periodStart","periodEnd","includedQuantity","usedQuantity"],"properties":{"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"includedQuantity":{"type":"integer","format":"int64","minimum":0},"usedQuantity":{"type":"integer","format":"int64","minimum":0,"description":"Active contacts the period's usage months counted so far, each month counting a contact once."}}},"ListServiceAccountsResponse":{"type":"object","required":["serviceAccounts"],"properties":{"serviceAccounts":{"type":"array","items":{"$ref":"#/components/schemas/ServiceAccount"}}}},"ServiceAccount":{"type":"object","description":"Identity that an integration acts as. API keys authenticate as a service account.","required":["id","tenantId","name","isActive","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"isActive":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"example":{"id":"sva_d7pilh9s682jt9mn3f3g","tenantId":"tn_d7phk42ge9t9t6324f20","name":"Production CRM sync","description":"Keeps contacts, events, and messages in sync with the CRM.","isActive":true,"createdAt":"2026-04-30T09:45:00Z","updatedAt":"2026-04-30T09:45:00Z"}},"CreateServiceAccountRequest":{"type":"object","description":"Integration identity to create.","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}},"example":{"name":"Production CRM sync","description":"Keeps contacts, events, and messages in sync with the CRM."}},"ListAPIKeysResponse":{"type":"object","description":"API keys for a service account.","required":["apiKeys"],"properties":{"apiKeys":{"type":"array","items":{"$ref":"#/components/schemas/APIKeyInfo"}}}},"APIKeyInfo":{"type":"object","description":"API key metadata. The plaintext key is returned only when the key is created.","required":["id","name","keyPrefix","serviceAccountId","tenantId","expiresAt","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"keyPrefix":{"type":"string","description":"First 8 characters of the key, for telling keys apart without the secret."},"serviceAccountId":{"type":"string"},"tenantId":{"type":"string"},"expiresAt":{"type":"string","format":"date-time","description":"API keys don't expire, so this is always `9999-12-31T23:59:59Z`."},"revokedAt":{"type":"string","format":"date-time","description":"When the key was revoked. Absent while the key is active."},"lastUsedAt":{"type":"string","format":"date-time","description":"When the key last authenticated a request."},"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"example":{"id":"apk_d7piqa1l2babdv94r440","name":"CRM production key","keyPrefix":"flw_8d2a","serviceAccountId":"sva_d7pilh9s682jt9mn3f3g","tenantId":"tn_d7phk42ge9t9t6324f20","expiresAt":"9999-12-31T23:59:59Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","createdAt":"2026-04-30T09:50:00Z","updatedAt":"2026-04-30T09:50:00Z"}},"CreateAPIKeyRequest":{"type":"object","description":"API key to create for the service account.","required":["name"],"properties":{"name":{"type":"string"}},"example":{"name":"CRM production key"}},"CreateAPIKeyResponse":{"type":"object","description":"The new API key's metadata and its plaintext value. The `key` value is shown only once.","required":["apiKey","key"],"properties":{"apiKey":{"$ref":"#/components/schemas/APIKeyInfo"},"key":{"type":"string","description":"Plaintext API key, starting with `flw_`. Shown only in this response."}},"example":{"apiKey":{"id":"apk_d7piqa1l2babdv94r440","name":"CRM production key","keyPrefix":"flw_8d2a","serviceAccountId":"sva_d7pilh9s682jt9mn3f3g","tenantId":"tn_d7phk42ge9t9t6324f20","expiresAt":"9999-12-31T23:59:59Z","createdBy":"usr_d7phosq4g7mv2l5b9l40","createdAt":"2026-04-30T09:50:00Z","updatedAt":"2026-04-30T09:50:00Z"},"key":"flw_8d2aJ4kQ9mXe7Rv2LpT6sWc1NbH5yZu3GfD8oKiA0qEw"}},"WebhookSettings":{"type":"object","description":"Webhook settings for the workspace. Each workspace has one webhook endpoint.","required":["enabled","verified","eventTypes","availableEventTypes"],"properties":{"id":{"type":"string"},"enabled":{"type":"boolean","description":"Whether events are delivered. Deliveries also require `verified`."},"verified":{"type":"boolean","description":"Whether `POST /webhooks:verify` succeeded for the saved `url`. Changing `url` clears it."},"url":{"type":"string","format":"uri","description":"HTTPS endpoint that receives deliveries."},"eventTypes":{"type":"array","description":"Event types Flownally delivers.","items":{"$ref":"#/components/schemas/WebhookEventType"}},"availableEventTypes":{"type":"array","description":"Event types this workspace can subscribe to.","items":{"$ref":"#/components/schemas/WebhookEventType"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"WebhookEventType":{"type":"string","enum":["contact.created","contact.updated","contact.archived","conversation.started","conversation.updated","conversation.closed","message.created","message.updated"]},"UpdateWebhookSettingsRequest":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEventType"}}}},"VerifyWebhookRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri"}}},"VerifyWebhookResponse":{"type":"object","required":["delivered"],"properties":{"delivered":{"type":"boolean"},"statusCode":{"type":"integer","format":"int32"},"error":{"type":"string"}}},"WebhookEventName":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$","description":"Webhook event type, such as `contact.created`."},"WebhookAttemptStatus":{"type":"string","enum":["succeeded","failed"]},"ListWebhookAttemptsResponse":{"type":"object","additionalProperties":false,"required":["webhookAttempts"],"properties":{"webhookAttempts":{"type":"array","items":{"$ref":"#/components/schemas/WebhookAttempt"}},"nextPageToken":{"type":"string"}}},"WebhookAttempt":{"type":"object","required":["id","eventId","eventType","status","deliveryId","attemptNumber","attemptedAt","latencyMs"],"properties":{"id":{"type":"string"},"eventId":{"type":"string"},"eventType":{"$ref":"#/components/schemas/WebhookEventName"},"status":{"$ref":"#/components/schemas/WebhookAttemptStatus"},"deliveryId":{"type":"string"},"attemptNumber":{"type":"integer","format":"int32"},"attemptedAt":{"type":"string","format":"date-time"},"responseStatus":{"type":"integer","format":"int32"},"responseBody":{"type":"string"},"latencyMs":{"type":"integer","format":"int64"},"errorText":{"type":"string"},"signedWithVersions":{"type":"array","items":{"type":"integer","format":"int32"}}}},"ListWebhookSigningKeysResponse":{"type":"object","required":["keys"],"properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/WebhookSigningKey"}}}},"WebhookSigningKey":{"type":"object","required":["id","version","status","createdAt"],"properties":{"id":{"type":"string"},"version":{"type":"integer","format":"int32"},"status":{"type":"string","description":"`active`, or `expiring` for the previous key during a rotation."},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","description":"When an `expiring` key stops signing deliveries. Set only for `expiring` keys."},"last4":{"type":"string","description":"Last 4 characters of the key, for telling keys apart."},"plaintextKey":{"type":"string","description":"The signing key in the form `whsec_<base64>`. Present only in the response that created the key."}}},"RotateWebhookSigningKeyResponse":{"type":"object","required":["key"],"properties":{"key":{"$ref":"#/components/schemas/WebhookSigningKey"}}},"WebhookPayload":{"description":"Signed webhook event body. Deduplicate deliveries by id, which matches the webhook-id header.","oneOf":[{"$ref":"#/components/schemas/ContactCreatedWebhookEvent"},{"$ref":"#/components/schemas/ContactUpdatedWebhookEvent"},{"$ref":"#/components/schemas/ContactArchivedWebhookEvent"},{"$ref":"#/components/schemas/ConversationStartedWebhookEvent"},{"$ref":"#/components/schemas/ConversationUpdatedWebhookEvent"},{"$ref":"#/components/schemas/ConversationClosedWebhookEvent"},{"$ref":"#/components/schemas/MessageCreatedWebhookEvent"},{"$ref":"#/components/schemas/MessageUpdatedWebhookEvent"},{"$ref":"#/components/schemas/WebhookTestEvent"}],"discriminator":{"propertyName":"type","mapping":{"contact.created":"#/components/schemas/ContactCreatedWebhookEvent","contact.updated":"#/components/schemas/ContactUpdatedWebhookEvent","contact.archived":"#/components/schemas/ContactArchivedWebhookEvent","conversation.started":"#/components/schemas/ConversationStartedWebhookEvent","conversation.updated":"#/components/schemas/ConversationUpdatedWebhookEvent","conversation.closed":"#/components/schemas/ConversationClosedWebhookEvent","message.created":"#/components/schemas/MessageCreatedWebhookEvent","message.updated":"#/components/schemas/MessageUpdatedWebhookEvent","webhook.test":"#/components/schemas/WebhookTestEvent"}}},"ContactCreatedWebhookEvent":{"type":"object","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["contact.created"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/ContactWebhookEventData"}}},"ContactWebhookEventData":{"type":"object","description":"The contact the event is about.","required":["contact"],"properties":{"contact":{"$ref":"#/components/schemas/Contact"}}},"ContactUpdatedWebhookEvent":{"type":"object","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["contact.updated"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/ContactWebhookEventData"}}},"ContactArchivedWebhookEvent":{"type":"object","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["contact.archived"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/ContactWebhookEventData"}}},"ConversationStartedWebhookEvent":{"type":"object","description":"A session started in a conversation. Sent once per session, when its first customer\nmessage or human agent's message arrives.\nOutbound automated messages (API, journey, campaign or desk) sent while the conversation\nhas no active session start no session; they are delivered without one. A conversation\ncan have many sessions over its lifetime.\n","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["conversation.started"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/ConversationWebhookEventData"}}},"ConversationWebhookEventData":{"type":"object","description":"The conversation, its contact and inbox, and the session the event is about. `inbox` and\n`conversation.inboxId` describe the inbox that owns the conversation. Expanded objects can\nshow changes made after the event. `conversation.status` is the event's\nsession status while that session is still the conversation's current one; for an event\nabout an earlier session it is the conversation's current status.\n","required":["conversation","sessionId","session","inboxId"],"properties":{"session":{"$ref":"#/components/schemas/WebhookSession"},"changedFields":{"type":"array","description":"Session fields changed by a `conversation.updated` or `conversation.closed` event; `conversation.started` omits it. A close lists `owner` only when the session had an owner; `session.owner` is null after a close. `owner` is also listed when a party Flownally does not run takes the conversation or hands it back. Omitted for some older events that recorded no changes.","items":{"type":"string","enum":["status","owner"]}},"sessionId":{"type":"string","minLength":1,"description":"Same as `session.id`, kept for existing integrations. New integrations should use `session.id`."},"inboxId":{"type":"string","minLength":1,"description":"ID of the inbox that owns the conversation. It never changes."},"conversation":{"$ref":"#/components/schemas/Conversation"},"contact":{"$ref":"#/components/schemas/Contact"},"inbox":{"$ref":"#/components/schemas/Inbox"}}},"WebhookSession":{"type":"object","description":"Session state when the event happened. Events can arrive out of order, and the expanded conversation can be newer than this state.","required":["id","owner"],"properties":{"id":{"type":"string","minLength":1},"status":{"type":"string","description":"Session status when the event happened. Omitted for some older events that didn't record it.","enum":["cold","pending","open","closed"]},"started":{"type":"boolean","description":"Whether the session had started at event time. The customer or human agent message\nthat opens a session starts it, so this is `true`; it can be `false` only for some\nolder sessions. Omitted for some older events that didn't record it.\n"},"owner":{"oneOf":[{"$ref":"#/components/schemas/WebhookSessionOwner"},{"type":"null"}]}}},"WebhookSessionOwner":{"type":"object","description":"Session owner when the event happened. Null when the session had no owner, including after it closed; for some older events, null can also mean the owner wasn't recorded. This is neither the message sender nor the inbox's default team.\n`external` means a party Flownally does not run, such as Meta's AI agent, holds the conversation; `id` names it, such as `meta_business_agent`, or is `unknown`. It is the same as the conversation's `activeOwner` and is shown while that party holds the conversation at delivery, for an event about the conversation's current session, so a delayed event shows who holds it now.\n","required":["type","id"],"properties":{"type":{"type":"string","enum":["user","chatbot","journey","service_account","inbox","external"]},"id":{"type":"string","minLength":1}}},"ConversationUpdatedWebhookEvent":{"type":"object","description":"An open session's status or owner changed; `changedFields` lists what changed, and\nchanges that aren't visible in the payload (such as team access) send nothing. For\nexample, a chatbot handing a session over to agents sends this event with\n`changedFields` `[\"status\", \"owner\"]` and `session.status` `pending`; Meta's AI agent\ntaking the conversation sends `changedFields` `[\"owner\"]` and `session.owner` `external`.\nStarting and closing a session send `conversation.started` and `conversation.closed`\ninstead, so `session.status` is never `closed` here.\n","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["conversation.updated"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/ConversationWebhookEventData"}}},"ConversationClosedWebhookEvent":{"type":"object","description":"A session closed. Sent once for every session that closes. A closed session is never\nreopened; the next message starts a new session in the same conversation.\n","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["conversation.closed"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/ConversationWebhookEventData"}}},"MessageCreatedWebhookEvent":{"type":"object","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["message.created"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/MessageWebhookEventData"}}},"MessageWebhookEventData":{"type":"object","description":"The message and the conversation, session, contact and inbox it belongs to. The IDs stay the same across retries; expanded objects can show changes made after the event.","required":["message","conversationId","session","inboxId"],"properties":{"session":{"description":"The session that handled the message; null when the message has none (see `Message.sessionId`).","oneOf":[{"$ref":"#/components/schemas/WebhookSessionReference"},{"type":"null"}]},"changedFields":{"type":"array","description":"Message fields this update changed, such as `reactions`. When `reactions` is listed, replace your stored reactions with `message.reactions`; an empty array clears them. Ignore events whose `message.revision` isn't newer than the revision you stored.","items":{"type":"string"}},"conversationId":{"type":"string","minLength":1,"description":"The conversation this message belongs to. Equals `message.conversationId`, and `conversation.id` when expanded."},"sessionId":{"type":"string","minLength":1,"description":"Same as `session.id` and `message.sessionId`, kept for existing integrations. Absent when `session` is null. New integrations should use `session.id`."},"inboxId":{"type":"string","minLength":1,"description":"ID of the inbox that owns the conversation. It never changes. On message events, the expanded `inbox` and `conversation.inboxId` can instead name the inbox the message came from or was delivered through."},"message":{"$ref":"#/components/schemas/Message"},"conversation":{"$ref":"#/components/schemas/Conversation"},"contact":{"$ref":"#/components/schemas/Contact"},"inbox":{"$ref":"#/components/schemas/Inbox"}}},"WebhookSessionReference":{"type":"object","description":"The session that handled the message, not the session that is active at delivery time.","required":["id"],"properties":{"id":{"type":"string","minLength":1}}},"MessageUpdatedWebhookEvent":{"type":"object","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header; use it to deduplicate deliveries."},"type":{"type":"string","enum":["message.updated"]},"timestamp":{"type":"string","format":"date-time","description":"When the change happened."},"data":{"$ref":"#/components/schemas/MessageWebhookEventData"}}},"WebhookTestEvent":{"type":"object","description":"Sent only by `POST /webhooks:verify` to confirm the endpoint. Respond with any `2xx` status. Carries no customer data.","required":["id","type","timestamp","data"],"properties":{"id":{"type":"string","description":"Event ID. Equals the `webhook-id` header."},"type":{"type":"string","enum":["webhook.test"]},"timestamp":{"type":"string","format":"date-time","description":"Time when the test event was sent."},"data":{"type":"object","required":["test"],"properties":{"test":{"type":"boolean"}}}}}},"parameters":{"MessageIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Client-generated key that makes a message send safe to retry. Use a new unique key for\nevery message; without a key, a retried request can send the message twice.\n\n- Keys are scoped to the workspace, not to an API key or a conversation.\n- Retrying with the same key and the same request from the same service account or user\n  returns the original message (same `id`) instead of sending it again.\n- Reusing a key for a different request or sender within 24 hours returns `409` with code\n  `messaging_messaging_idempotency_conflict`.\n- After 24 hours, a key whose message was accepted still returns that message and never\n  sends it again, even if the new request has different content.\n- After `503` with code `messaging_messaging_send_result_pending`, retry with the same key.\n","schema":{"type":"string","minLength":1,"maxLength":255}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Key you generate so a retried request isn't applied twice. Use a new key for each new request and the same key for each retry of it.","schema":{"type":"string","minLength":1,"maxLength":255}},"SegmentID":{"name":"segmentId","in":"path","required":true,"description":"Segment ID.","schema":{"type":"string"}},"IfMatch":{"name":"If-Match","in":"header","required":false,"description":"Required to update or delete a segment. Supply one strong segment `ETag`, for example\n`\"seg_abc:3\"`.","schema":{"type":"string","maxLength":128,"pattern":"^\"seg_[^\"]+:[1-9][0-9]*\"$"}},"CampaignID":{"name":"campaignId","in":"path","required":true,"description":"Campaign ID.","schema":{"type":"string","minLength":1}},"CampaignsIfMatch":{"name":"If-Match","in":"header","required":false,"description":"Optional. The campaign's current `ETag`. A stale value returns 412\n`contacts_campaign_revision_mismatch`.","schema":{"type":"string"}}},"headers":{"Etag":{"description":"Entity tag for the segment's current revision, for example `\"seg_abc:3\"`. Send it in\n`If-Match` to update or delete the segment.","schema":{"type":"string"}},"CampaignsEtag":{"description":"Strong entity tag containing the campaign ID and revision, for example `\"cmp_abc:3\"`. Send\nit in `If-Match` to make sure the campaign has not changed since you read it.","schema":{"type":"string"}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"x-flownally-authz":{"roles":[{"role":"owner","description":"Workspace owner with full tenant authority."},{"role":"admin","description":"Workspace administrator with operational authority except owner-only billing changes and API key creation."},{"role":"agent","description":"Workspace agent with scoped customer conversation authority."}],"permissions":[{"permission":"conversation:list","resource":"conversation","description":"List conversations accessible to the caller.","sensitive":false,"scope":"conversation"},{"permission":"conversation:read","resource":"conversation","description":"Read a conversation accessible to the caller.","sensitive":false,"scope":"conversation"},{"permission":"conversation:assign","resource":"conversation","description":"Assign or reassign a conversation accessible to the caller.","sensitive":false,"scope":"conversation"},{"permission":"conversation:close","resource":"conversation","description":"Close a conversation accessible to the caller.","sensitive":false,"scope":"conversation"},{"permission":"conversation:ban","resource":"conversation","description":"Ban or unban the customer of a conversation accessible to the caller.","sensitive":false,"scope":"conversation"},{"permission":"message:create","resource":"message","description":"Create a message in an authorized conversation.","sensitive":false,"scope":"conversation"},{"permission":"inbox:list","resource":"inbox","description":"List inboxes in the caller's tenant.","sensitive":false},{"permission":"inbox:read","resource":"inbox","description":"Read an inbox in the caller's tenant.","sensitive":false},{"permission":"inbox:create","resource":"inbox","description":"Create an inbox in the caller's tenant.","sensitive":false},{"permission":"inbox:update","resource":"inbox","description":"Update an inbox in the caller's tenant.","sensitive":false},{"permission":"inbox:delete","resource":"inbox","description":"Delete an inbox in the caller's tenant.","sensitive":false},{"permission":"team:list","resource":"team","description":"List teams in the caller's tenant.","sensitive":false},{"permission":"team:read","resource":"team","description":"Read a team in the caller's tenant.","sensitive":false},{"permission":"team:create","resource":"team","description":"Create a team in the caller's tenant.","sensitive":true},{"permission":"team:update","resource":"team","description":"Update a team in the caller's tenant.","sensitive":false},{"permission":"team:delete","resource":"team","description":"Delete a team in the caller's tenant.","sensitive":true},{"permission":"team:assign_user","resource":"team","description":"Add a user to a team in the caller's tenant.","sensitive":true},{"permission":"team:remove_user","resource":"team","description":"Remove a user from a team in the caller's tenant.","sensitive":true},{"permission":"tenant:read","resource":"tenant","description":"Read tenant settings.","sensitive":false},{"permission":"tenant:update","resource":"tenant","description":"Update tenant settings.","sensitive":true},{"permission":"user:list","resource":"user","description":"List users in the caller's tenant.","sensitive":false},{"permission":"user:read","resource":"user","description":"Read a user in the caller's tenant.","sensitive":false},{"permission":"user:read_self","resource":"user","description":"Read the caller's own user record.","sensitive":false},{"permission":"user:update_self","resource":"user","description":"Update the caller's own profile.","sensitive":false},{"permission":"user:update","resource":"user","description":"Update a user in the caller's tenant.","sensitive":true},{"permission":"user:disable","resource":"user","description":"Remove a member from the active workspace roster.","sensitive":true},{"permission":"user:assign_role_owner","resource":"user","description":"Assign the owner role to a user.","sensitive":true},{"permission":"user:assign_role_admin","resource":"user","description":"Assign the admin role to a user.","sensitive":true},{"permission":"user:assign_role_agent","resource":"user","description":"Assign the agent role to a user.","sensitive":true},{"permission":"api_key:list","resource":"api_key","description":"List API keys or service accounts in the caller's tenant.","sensitive":false},{"permission":"api_key:create","resource":"api_key","description":"Create an API key or service account in the caller's tenant.","sensitive":true},{"permission":"api_key:revoke","resource":"api_key","description":"Revoke an API key or service account in the caller's tenant.","sensitive":true},{"permission":"contact:list","resource":"contact","description":"List contacts visible to the caller.","sensitive":false,"scope":"contact"},{"permission":"contact:read","resource":"contact","description":"Read a contact visible to the caller.","sensitive":false,"scope":"contact"},{"permission":"contact:create","resource":"contact","description":"Create a contact in the caller's tenant.","sensitive":false},{"permission":"contact:update","resource":"contact","description":"Update a contact visible to the caller.","sensitive":false,"scope":"contact"},{"permission":"contact:delete","resource":"contact","description":"Delete a contact visible to the caller.","sensitive":false,"scope":"contact"},{"permission":"segment:list","resource":"segment","description":"List saved contact segments in the caller's tenant.","sensitive":false},{"permission":"segment:read","resource":"segment","description":"Read and use a saved contact segment in the caller's tenant.","sensitive":false},{"permission":"segment:create","resource":"segment","description":"Create a saved contact segment in the caller's tenant.","sensitive":true},{"permission":"segment:update","resource":"segment","description":"Update a saved contact segment in the caller's tenant.","sensitive":true},{"permission":"segment:delete","resource":"segment","description":"Delete a saved contact segment in the caller's tenant.","sensitive":true},{"permission":"report:read","resource":"report","description":"Read reports in the caller's visible tenant data.","sensitive":false},{"permission":"campaign:list","resource":"campaign","description":"List campaigns in the caller's tenant.","sensitive":false},{"permission":"campaign:read","resource":"campaign","description":"Read a campaign in the caller's tenant.","sensitive":false},{"permission":"campaign:create","resource":"campaign","description":"Create a campaign in the caller's tenant.","sensitive":false},{"permission":"campaign:update","resource":"campaign","description":"Update a draft campaign in the caller's tenant.","sensitive":false},{"permission":"campaign:delete","resource":"campaign","description":"Delete a draft or sent campaign in the caller's tenant.","sensitive":false},{"permission":"campaign:schedule","resource":"campaign","description":"Schedule or unschedule a campaign in the caller's tenant.","sensitive":false},{"permission":"campaign:recipients","resource":"campaign","description":"List campaign recipients visible to the caller.","sensitive":false},{"permission":"tag:list","resource":"tag","description":"List contact tags in the caller's tenant.","sensitive":false},{"permission":"tag:read","resource":"tag","description":"Read a contact tag in the caller's tenant.","sensitive":false},{"permission":"tag:create","resource":"tag","description":"Create a contact tag in the caller's tenant.","sensitive":false},{"permission":"tag:update","resource":"tag","description":"Update a contact tag in the caller's tenant.","sensitive":false},{"permission":"tag:delete","resource":"tag","description":"Delete a contact tag in the caller's tenant.","sensitive":false},{"permission":"custom_field:list","resource":"custom_field","description":"List custom field definitions in the caller's tenant.","sensitive":false},{"permission":"custom_field:read","resource":"custom_field","description":"Read a custom field definition in the caller's tenant.","sensitive":false},{"permission":"custom_field:create","resource":"custom_field","description":"Create a custom field definition in the caller's tenant.","sensitive":false},{"permission":"custom_field:update","resource":"custom_field","description":"Update a custom field definition in the caller's tenant.","sensitive":false},{"permission":"custom_field:delete","resource":"custom_field","description":"Delete a custom field definition in the caller's tenant.","sensitive":false},{"permission":"event:list","resource":"event","description":"List events in the caller's tenant.","sensitive":false},{"permission":"event:read","resource":"event","description":"Read an event in the caller's tenant.","sensitive":false},{"permission":"event:create","resource":"event","description":"Create an event in the caller's tenant.","sensitive":false},{"permission":"event_type:list","resource":"event_type","description":"List event types in the caller's tenant.","sensitive":false},{"permission":"event_type:read","resource":"event_type","description":"Read an event type in the caller's tenant.","sensitive":false},{"permission":"event_type:create","resource":"event_type","description":"Create an event type in the caller's tenant.","sensitive":false},{"permission":"event_type:update","resource":"event_type","description":"Update an event type in the caller's tenant.","sensitive":false},{"permission":"event_type:delete","resource":"event_type","description":"Delete an event type in the caller's tenant.","sensitive":false},{"permission":"journey:list","resource":"journey","description":"List journeys in the caller's tenant.","sensitive":false},{"permission":"journey:read","resource":"journey","description":"Read a journey in the caller's tenant.","sensitive":false},{"permission":"journey:create","resource":"journey","description":"Create a journey in the caller's tenant.","sensitive":false},{"permission":"journey:update","resource":"journey","description":"Update a journey in the caller's tenant.","sensitive":false},{"permission":"journey:delete","resource":"journey","description":"Delete a journey in the caller's tenant.","sensitive":false},{"permission":"journey:publish","resource":"journey","description":"Publish a journey version in the caller's tenant.","sensitive":false},{"permission":"journey:activate","resource":"journey","description":"Activate or pause a journey in the caller's tenant.","sensitive":false},{"permission":"journey:use_secrets","resource":"journey","description":"Save, publish or activate a journey whose HTTP requests send workspace secrets.","sensitive":true},{"permission":"billing:read","resource":"billing","description":"Read billing status for the caller's tenant.","sensitive":false},{"permission":"billing:update","resource":"billing","description":"Create or update billing sessions and subscription state.","sensitive":true},{"permission":"webhook:read","resource":"webhook","description":"Read webhook configuration, signing keys, and delivery attempts.","sensitive":false},{"permission":"webhook:update","resource":"webhook","description":"Create, update, verify, or rotate webhook configuration.","sensitive":true},{"permission":"webhook:delete","resource":"webhook","description":"Delete webhook configuration.","sensitive":true},{"permission":"widget:list","resource":"widget","description":"List widgets in the caller's tenant.","sensitive":false},{"permission":"widget:read","resource":"widget","description":"Read a widget in the caller's tenant.","sensitive":false},{"permission":"widget:create","resource":"widget","description":"Create a widget in the caller's tenant.","sensitive":true},{"permission":"widget:update","resource":"widget","description":"Update a widget in the caller's tenant.","sensitive":true},{"permission":"widget:delete","resource":"widget","description":"Delete a widget in the caller's tenant.","sensitive":true},{"permission":"migration:cutover","resource":"migration","description":"Run a manually approved channel migration cutover.","sensitive":true}],"grants":[{"role":"owner","permissions":["conversation:list","conversation:read","conversation:assign","conversation:close","conversation:ban","message:create","inbox:list","inbox:read","inbox:create","inbox:update","inbox:delete","team:list","team:read","team:create","team:update","team:delete","team:assign_user","team:remove_user","tenant:read","tenant:update","user:list","user:read","user:read_self","user:update_self","user:update","user:disable","user:assign_role_owner","user:assign_role_admin","user:assign_role_agent","api_key:list","api_key:create","api_key:revoke","contact:list","contact:read","contact:create","contact:update","contact:delete","segment:list","segment:read","segment:create","segment:update","segment:delete","report:read","campaign:list","campaign:read","campaign:create","campaign:update","campaign:delete","campaign:schedule","campaign:recipients","tag:list","tag:read","tag:create","tag:update","tag:delete","custom_field:list","custom_field:read","custom_field:create","custom_field:update","custom_field:delete","event:list","event:read","event:create","event_type:list","event_type:read","event_type:create","event_type:update","event_type:delete","journey:list","journey:read","journey:create","journey:update","journey:delete","journey:publish","journey:activate","journey:use_secrets","billing:read","billing:update","webhook:read","webhook:update","webhook:delete","widget:list","widget:read","widget:create","widget:update","widget:delete"]},{"role":"admin","permissions":["conversation:list","conversation:read","conversation:assign","conversation:close","conversation:ban","message:create","inbox:list","inbox:read","inbox:create","inbox:update","inbox:delete","team:list","team:read","team:create","team:update","team:delete","team:assign_user","team:remove_user","tenant:read","tenant:update","user:list","user:read","user:read_self","user:update_self","user:update","user:disable","user:assign_role_admin","user:assign_role_agent","api_key:list","api_key:revoke","contact:list","contact:read","contact:create","contact:update","contact:delete","segment:list","segment:read","segment:create","segment:update","segment:delete","report:read","campaign:list","campaign:read","campaign:create","campaign:update","campaign:delete","campaign:schedule","campaign:recipients","tag:list","tag:read","tag:create","tag:update","tag:delete","custom_field:list","custom_field:read","custom_field:create","custom_field:update","custom_field:delete","event:list","event:read","event:create","event_type:list","event_type:read","event_type:create","event_type:update","event_type:delete","journey:list","journey:read","journey:create","journey:update","journey:delete","journey:publish","journey:activate","journey:use_secrets","billing:read","webhook:read","webhook:update","webhook:delete","widget:list","widget:read","widget:create","widget:update","widget:delete"]},{"role":"agent","permissions":["conversation:list","conversation:read","conversation:assign","conversation:close","conversation:ban","message:create","inbox:list","inbox:read","team:list","team:read","tenant:read","user:list","user:read","user:read_self","user:update_self","contact:list","contact:read","contact:create","contact:update","contact:delete","segment:list","segment:read","campaign:list","campaign:read","tag:list","tag:read","tag:create","tag:update","custom_field:list","custom_field:read","custom_field:create","custom_field:update","custom_field:delete","event:list","event:read","event:create","event_type:list","event_type:read","event_type:create","event_type:update","event_type:delete","journey:list","journey:read","journey:create","journey:update","journey:delete","journey:publish","journey:activate"]}]}}