API
The Parahelp API connects any channel to your customer agents: your system sends what happens as events, and reads the replies back.
Use it to build a custom channel, such as a live chat, a Slack bot or an email inbox. Parahelp gives your developer or coding agent a working template and the full guide in a chat, so this page only covers the essentials. Read more in Customer agents.
The API is in beta. Contact Parahelp to enable it for your workspace.
Concepts
Sessions. A session is a list of events, and it’s what Parahelp shows as a ticket, for example one live chat conversation, Slack thread or email thread. Each session has an id, usually one you choose.
Events. An event is something that happened, such as a customer message or an order update. Your customer agents react to events.
Agent profiles. An agent profile defines a customer agent with its configurations. Parahelp creates them for you, and each session runs the customer agent of the agent profile it selects.
Authentication
Send your API key with every request:
Authorization: Bearer <API key>Admins create and delete API keys in Settings → API keys. A key gives full access to your workspace’s Parahelp API, so keep it on your server, never in a browser or mobile app.
Flow
1. List your agent profiles
List your agent profiles to get their ids.
/api/v0/support/agent-profiles curl https://external-api.parahelp.com/api/v0/support/agent-profiles \
-H "Authorization: Bearer $PARAHELP_API_KEY"2. Send events
Send what happens in a conversation as data events. The first event creates the session.
/api/v0/support/events/api/data curl -X POST \
https://external-api.parahelp.com/api/v0/support/events/api/data \
-H "Authorization: Bearer $PARAHELP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10",
"payload": {
"type": "customer_message",
"message": "My order has not arrived."
}
}'3. Select the agent profile
Select the agent profile that handles the session, and set its environment variables.
/api/v0/support/events/api/session-updated curl -X POST \
https://external-api.parahelp.com/api/v0/support/events/api/session-updated \
-H "Authorization: Bearer $PARAHELP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10",
"agent_profile_id": "website-support",
"environment_variables": {
"USER_EMAIL": "jane@example.com"
}
}'4. Read the replies
Read the session’s events back, and show your customer the replies.
/api/v0/support/events curl -G https://external-api.parahelp.com/api/v0/support/events \
--data-urlencode "session_id=8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10" \
-H "Authorization: Bearer $PARAHELP_API_KEY"Good to know
Replies come through scoped tools. A customer agent replies only through the scoped tools Parahelp builds for the channel, and each reply shows up as an event in the session.
Events are processed asynchronously. A
202response means the event is recorded, not that a customer agent has run.Environment variables aren’t secrets. Use them for values your scoped tools need, such as the customer’s email. Your customer agents can see them, so secrets go in Parahelp secrets.
Pausing. Send
agent_profile_id: nullto pause the customer agent on a session, for example when your team takes over. The session keeps recording events.Live data. There’s no test environment, so a test conversation is a real ticket.
Reference
The reference is generated from the OpenAPI spec. The base URL is https://external-api.parahelp.com.
- POST
/api/Send data eventv0/ support/ events/ api/ data - POST
/api/Send session updated eventv0/ support/ events/ api/ session-updated - GET
/api/List support eventsv0/ support/ events - GET
/api/List support sessionsv0/ support/ sessions - GET
/api/List agent profilesv0/ support/ agent-profiles
Send data event
/api/v0/support/events/api/data BetaSend a data event: any JSON describing something that happened, such as a customer message, an order update, or a reply sent by one of your custom tools. The customer agent sees the JSON value you sent.
We recommend two default types, which the customer agent knows without further instructions: customer_message for what a customer wrote, and parahelp_agent_message for a reply a custom tool sends. Nothing requires them.
A session is a list of events. Generate a unique id for each session, typically a UUID, and send it as session_id with every event of the session; the first event creates the session. If you omit session_id, a new session is created and its generated session_id is returned.
A new session has no agent profile, so its events do not run the customer agent until a session updated event (POST /api/v0/support/events/api/session-updated) selects one; the customer agent then also sees the earlier events. After that, every data event asks the customer agent to run, including events your custom tools send. Events that arrive close together or during a run may be handled by one run, and the customer agent can decide to do nothing.
The supplied event fields, serialized as compact UTF-8 JSON after validation, must be at most 51,200 bytes. Request formatting whitespace does not count. Larger events return 422.
JSON keys and string values must contain valid Unicode. Tab, newline, and carriage return are allowed; other control characters, including NUL, are rejected. These rules also apply inside nested data. Numbers must be finite: NaN, Infinity, -Infinity, and numbers that overflow to infinity are rejected. Strings such as "NaN" remain valid. Rejected events return 422 and are not recorded.
A 202 response with stored: true means the event is recorded. The customer agent receives it, and the session’s agent profile and environment variables update, asynchronously. GET /api/v0/support/events lists the recorded event, when its type is requested, as soon as this request returns.
Supply event_id, together with your own session_id, on the first request to make retries safe. Both event endpoints share one set of event ids. A retry with the same event_id, the same contents, and the same session_id in the same letter case receives duplicate: true. For session updated events, omitting a setting is different content from sending it as null or {}. Reusing an event_id for another event type, different contents, or a different session_id, including one that differs only in letter case, returns 409. Without event_id, every request records a new event and returns event_id: null.
Send a customer message
curl -X POST \
https://external-api.parahelp.com/api/v0/support/events/api/data \
-H "Authorization: Bearer $PARAHELP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10",
"payload": {
"type": "customer_message",
"message": "My order has not arrived.",
"user_identifier": "usr_18273",
"user_name": "Jane",
"user_email": "jane@example.com"
}
}'Send a reply from a custom tool
curl -X POST \
https://external-api.parahelp.com/api/v0/support/events/api/data \
-H "Authorization: Bearer $PARAHELP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10",
"payload": {
"type": "parahelp_agent_message",
"message": "Hi Jane, could you share your order number so I can check its status?"
}
}'Send any JSON
curl -X POST \
https://external-api.parahelp.com/api/v0/support/events/api/data \
-H "Authorization: Bearer $PARAHELP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10",
"payload": {
"event": "return_requested",
"order_id": "5678",
"preferred_resolution": "Exchange for size L",
"customer_note": "I need it before my trip next Friday."
}
}'Request body
session_idstring or null · up to 140 charactersYour id for the session, typically a UUID you generate, at most 128 characters. Send the same id with every event of the session; the first event creates the session. Your ids receive an api_session_ prefix, which does not count toward the limit; ids that already start with the lowercase api_session_ or api_generated_session_, such as a session_id returned by this API, are used as given. Omit this field or send null to start a new session with a generated id, returned in the response. Ids may contain only lowercase ASCII letters, digits, '.', '_', ':' and '-'; surrounding whitespace is ignored. An uppercase letter returns 422, because ids that differ only by case would name the same session: map case-sensitive ids of your own to distinct lowercase ones.
event_idstring or null · up to 138 charactersYour id for the event, at most 128 characters, unique among your organization’s API events. Your ids receive an api_event_ prefix, which does not count toward the limit; values that already start with api_event_ are used as given. Supply it on the first request to make retries safe: a retry with the same event_id, session_id and contents returns duplicate: true, and reusing it with different contents or a different session_id returns 409. Omit it or send null to record a new event, without an external id, on every request. Ids may contain only lowercase ASCII letters, digits, '.', '_', ':' and '-'; surrounding whitespace is ignored. An uppercase letter returns 422, because ids that differ only by case would name the same event.
payloadany JSON requiredWhat happened, as any JSON value: an object, array, string, number, boolean or null. The customer agent sees this JSON value. A data event asks the customer agent to run when the session has an agent profile; new sessions have none.
Responses
202The recorded event’s identifiers.storedboolean · always true requiredThe event is recorded.
event_idstring or null requiredYour event_id as stored, with its api_event_ prefix, when you supplied one; otherwise null.
duplicateboolean requiredTrue when this event_id was already recorded with the same session_id and contents; nothing new was recorded.
session_idstring requiredThe session the event was recorded for. Send it as session_id with the session’s later events, and use it to read the session’s events.
- Errors
400 401 403 409 415 422 500400The request body could not be decoded, for example because it is not valid UTF-8.401Missing or invalid API key or execution token, or one whose key was deleted or whose token expired.403Your organization does not have Support API access. Contact Parahelp to enable it.409The event_id was already recorded with different contents or a different session_id.415Unsupported Media Type. TheContent-Typeheader must beapplication/json.422Request validation error: malformed JSON, unknown or missing fields, an invalid session_id, event_id or agent_profile_id, disallowed characters, non-finite numbers, or an event over the size limit. Session updated events also reject invalid environment-variable names, PARAHELP_SESSION_ID, and names matching organization secrets.500Internal server error. The event may have been recorded; retry with the same event_id and session_id. A request without a session_id cannot be retried this way.
Send session updated event
/api/v0/support/events/api/session-updated BetaAll environment-variable names and values are visible to the customer agent and stored in session event history. Do not include passwords, API keys, access tokens, or other secrets; give custom tools secrets as Parahelp secrets. Updating or clearing variables does not erase earlier values from event history.
Send a session updated event: it changes the session’s agent profile and environment variables together. Omitted settings stay unchanged. New sessions start without an agent profile or variables.
Select the agent profile whose customer agent handles the session by an agent_profile_id from GET /api/v0/support/agent-profiles, exactly as listed. Send agent_profile_id: null to remove it: the session keeps recording events, but they no longer run the customer agent. The same happens when the selected agent profile is deleted, until you select another.
Use environment variables for values your custom tools need that the customer agent should not supply, such as the customer’s email for a refund tool. A provided environment_variables map replaces all previous variables; {} removes them all, and null is invalid. Custom tools receive the resulting variables. Names matching your organization’s secrets are rejected; if a matching secret is added later, tool calls that need it fail until you rename or remove the variable.
Like a data event, every recorded session updated event asks the customer agent to run when the session has an agent profile, and gives it new attempts if earlier runs failed. Events that arrive close together or during a run may be handled by one run. A run already in progress keeps the agent profile and variables it started with.
Every request records a new event, even one that changes nothing, unless it returns duplicate: true. Retries are validated again, so a retry can return 404 or 422 if the agent profile or your organization’s secrets changed in between.
The supplied event fields, serialized as compact UTF-8 JSON after validation, must be at most 51,200 bytes. Request formatting whitespace does not count. Larger events return 422.
JSON keys and string values must contain valid Unicode. Tab, newline, and carriage return are allowed; other control characters, including NUL, are rejected. These rules also apply inside nested data. Numbers must be finite: NaN, Infinity, -Infinity, and numbers that overflow to infinity are rejected. Strings such as "NaN" remain valid. Rejected events return 422 and are not recorded.
A 202 response with stored: true means the event is recorded. The customer agent receives it, and the session’s agent profile and environment variables update, asynchronously. GET /api/v0/support/events lists the recorded event, when its type is requested, as soon as this request returns.
Supply event_id, together with your own session_id, on the first request to make retries safe. Both event endpoints share one set of event ids. A retry with the same event_id, the same contents, and the same session_id in the same letter case receives duplicate: true. For session updated events, omitting a setting is different content from sending it as null or {}. Reusing an event_id for another event type, different contents, or a different session_id, including one that differs only in letter case, returns 409. Without event_id, every request records a new event and returns event_id: null.
curl -X POST \
https://external-api.parahelp.com/api/v0/support/events/api/session-updated \
-H "Authorization: Bearer $PARAHELP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10",
"agent_profile_id": "website-support",
"environment_variables": {
"USER_EMAIL": "jane@example.com"
}
}'Request body
agent_profile_idstring or null · up to 128 charactersThe agent profile to select, matching a configured API agent profile id exactly, or null to remove the session’s agent profile so its events no longer run the customer agent. Omit to keep the current one. An active run keeps its captured inputs.
environment_variablesobjectAll names and values are visible to the customer agent and stored in session event history. Do not include passwords, API keys, access tokens, or other secrets; give custom tools secrets as Parahelp secrets. Use them for values your custom tools need that the customer agent should not supply, such as the customer’s email. Updating or clearing variables does not erase earlier values from event history. Replaces all of the session’s environment variables; {} removes them all. Omit to keep them. Null is invalid. Later runs and their custom tools receive the resulting map; an active run keeps its values. Names use letters, digits and underscores and do not start with a digit. Names matching existing organization secrets, including connected integration secrets, are rejected with 422 before storing the event; matching is case-sensitive. PARAHELP_SESSION_ID is rejected too: custom tools receive the session’s ID under that name.
session_idstring or null · up to 140 charactersYour id for the session, typically a UUID you generate, at most 128 characters. Send the same id with every event of the session; the first event creates the session. Your ids receive an api_session_ prefix, which does not count toward the limit; ids that already start with the lowercase api_session_ or api_generated_session_, such as a session_id returned by this API, are used as given. Omit this field or send null to start a new session with a generated id, returned in the response. Ids may contain only lowercase ASCII letters, digits, '.', '_', ':' and '-'; surrounding whitespace is ignored. An uppercase letter returns 422, because ids that differ only by case would name the same session: map case-sensitive ids of your own to distinct lowercase ones.
event_idstring or null · up to 138 charactersYour id for the event, at most 128 characters, unique among your organization’s API events. Your ids receive an api_event_ prefix, which does not count toward the limit; values that already start with api_event_ are used as given. Supply it on the first request to make retries safe: a retry with the same event_id, session_id and contents returns duplicate: true, and reusing it with different contents or a different session_id returns 409. Omit it or send null to record a new event, without an external id, on every request. Ids may contain only lowercase ASCII letters, digits, '.', '_', ':' and '-'; surrounding whitespace is ignored. An uppercase letter returns 422, because ids that differ only by case would name the same event.
Responses
202The recorded event’s identifiers.storedboolean · always true requiredThe event is recorded.
event_idstring or null requiredYour event_id as stored, with its api_event_ prefix, when you supplied one; otherwise null.
duplicateboolean requiredTrue when this event_id was already recorded with the same session_id and contents; nothing new was recorded.
session_idstring requiredThe session the event was recorded for. Send it as session_id with the session’s later events, and use it to read the session’s events.
- Errors
400 401 403 404 409 415 422 500400The request body could not be decoded, for example because it is not valid UTF-8.401Missing or invalid API key or execution token, or one whose key was deleted or whose token expired.403Your organization does not have Support API access. Contact Parahelp to enable it.404The agent_profile_id does not exactly match a configured API agent profile.409The event_id was already recorded with different contents or a different session_id.415Unsupported Media Type. TheContent-Typeheader must beapplication/json.422Request validation error: malformed JSON, unknown or missing fields, an invalid session_id, event_id or agent_profile_id, disallowed characters, non-finite numbers, or an event over the size limit. Session updated events also reject invalid environment-variable names, PARAHELP_SESSION_ID, and names matching organization secrets.500Internal server error. The event may have been recorded; retry with the same event_id and session_id. A request without a session_id cannot be retried this way.
List support events
/api/v0/support/events BetaList a support session’s events in recorded order. Only data events are listed by default.
Pass type once for each event type to list: api_data and api_session_updated for the data and session updated events you sent, support_agent_run_started and support_agent_run_finished for customer agent runs, internal_agent_message_received for Parahelp messages received by the customer agent, member_message_received for messages a member of your team wrote in the ticket for the customer agent to send as written, tool_called and tool_finished for tool calls and results, error for errors, and session_sync_requested for requests to process the session again. Events of other types do not count toward pagination.
Use it to show a session’s conversation. The customer agent replies only through your custom tools: a tool can send its reply back as a data event, or return it as its result, which tool_finished lists. Show end users only the events you choose: tool events and Parahelp messages can contain your agent profile’s memory, search results, and internal instructions. Call it from your backend and check the viewer’s access there; never put an API key in a browser or mobile app.
Each event has event_id, type, data, and occurred_at. data is a JSON object whose fields depend on type and may change. Roughly: api_data holds your payload; api_session_updated the settings you sent; run events a run_id, and support_agent_run_finished also an outcome; tool_called and tool_finished the tool_name and a tool_call_id linking them, with the arguments or the result content and is_error; error an error_message; internal_agent_message_received and member_message_received the message content; session_sync_requested a reset_failures flag.
Tool arguments, results, failure text, and a custom tool’s stderr can contain customer data. Parahelp removes the exact values of your secrets from custom tool output; tools must not output secrets in any other form. Long tool results and stderr are truncated.
Only support_agent_run_finished marks the end of a run; the run can continue after an error or a failed tool call. A run interrupted by an outage can end without one, so do not wait for it indefinitely. A failure before a run starts is an error event with a null run_id. A failed tool call is listed as a tool_finished event and one or more error events. Unexpected failures say 'An internal error occurred. Please contact Parahelp.' Custom tool failures say 'Failed to run custom tool', followed by the tool’s output when it returned one. Tool input and configuration errors keep their messages.
The response holds one page of events and a next_cursor; send it back unchanged as cursor, with the same session_id and type, to fetch the next page. next_cursor is null on the last page, so to check for new events, list the session again from the first page. An unknown session or an unrecognized cursor returns an empty page.
curl -G https://external-api.parahelp.com/api/v0/support/events \
--data-urlencode "session_id=8e2d7a36-3a1c-4a6e-9f21-9d1b8c5e4f10" \
-H "Authorization: Bearer $PARAHELP_API_KEY"Query parameters
session_idstring · up to 140 characters requiredThe session whose events to list: your session id or the session_id returned by this API, without surrounding whitespace.
typearray of strings · default api_dataAn event type to list. Repeat it to list several types. Defaults to api_data.
One of
api_data,api_session_updated,support_agent_run_started,support_agent_run_finished,error,internal_agent_message_received,member_message_received,tool_called,tool_finished,session_sync_requestedlimitinteger · default 100 · 1 to 200Maximum number of events to return per page.
cursorstring or nullThe next_cursor from a previous response, unchanged. Omit to fetch the first page.
Responses
200One page of the session’s events, in recorded order.eventsarray of objects requiredOne page of public events, in recorded order.
event_idstring or null requiredYour event_id, with its api_event_ prefix, for an event you sent with one; an id Parahelp assigned for a Parahelp message; otherwise null.
typestring requireddataobject requiredoccurred_atdate-time string requiredWhen Parahelp recorded the event. Events are listed in recording order, which can differ slightly from this time.
next_cursorstring or null requiredPass as cursor for the next page; null when there are no more events.
- Errors
401 403 422 500401Missing or invalid API key or execution token, or one whose key was deleted or whose token expired.403Your organization does not have Support API access. Contact Parahelp to enable it.422Request validation error. The query parameters are invalid.500Internal server error. Events could not be listed.
List support sessions
/api/v0/support/sessions BetaPass type=api to list your organization’s API sessions with their current agent profile and environment variables, newest first by first event. Only API sessions are listed.
A session appears shortly after its first event is accepted, and its state catches up with later events asynchronously. The response holds one page of sessions and a next_cursor; send it back unchanged as cursor to fetch the next page. next_cursor is null on the last page. An unrecognized cursor returns an empty page.
Pass environment_variable=NAME:VALUE to list only the sessions whose current environment variable NAME equals VALUE exactly, for example a customer’s other sessions by USER_EMAIL. Keep the same environment_variable when following next_cursor.
curl -G https://external-api.parahelp.com/api/v0/support/sessions \
--data-urlencode "type=api" \
-H "Authorization: Bearer $PARAHELP_API_KEY"Query parameters
typestring · always api requiredRequired session type. Currently only api is supported.
environment_variablestring or null · up to 1000 charactersOnly sessions whose current environment variable NAME equals VALUE, given as NAME:VALUE and split at the first colon. The match is exact: case-sensitive, the whole value, and a session without NAME never matches. Only API sessions have environment variables. URL-encode the pair, and send a literal + as %2B. A page can hold fewer sessions than limit, or none, while next_cursor is set: keep paging until next_cursor is null. A session matches a new value once the session updated event that set it has been processed, usually within seconds. The lookup reads the newest 2,000,000 characters of each session’s events, and at most 100,000 characters of any one event, so a session whose variables were set before that window, or in an event longer than that, is not found.
limitinteger · default 100 · 1 to 200Maximum number of sessions to return per page.
cursorstring or nullThe next_cursor from a previous response, unchanged. Omit to fetch the first page.
Responses
200One page of support sessions, newest first.sessionsarray of objects requiredOne page of API support sessions, newest first.
session_idstring requiredThe session id: the same id the /api/v0/support/events endpoints take and return.
session_dataobject requiredThe session’s selected agent profile and environment variables.
typestring · always api requiredThe source the session comes from.
agent_profile_idstring or null requiredThe agent profile last selected for the session, or null when none is selected. It can name an agent profile that was deleted since; the session then runs nothing.
environment_variablesobject requiredThe environment variables last set for the session, {} when none are set. The customer agent sees them, and its custom tools receive them as environment variables of the same names.
first_event_occurred_atdate-time string requiredWhen Parahelp recorded the session’s earliest event; the listing’s order key, newest first.
latest_event_occurred_atdate-time string requiredWhen Parahelp recorded the session’s latest event, including internal events that GET /api/v0/support/events does not list. Updates asynchronously.
next_cursorstring or null requiredOpaque cursor to send as the cursor query parameter to fetch the next page. Null when there are no more sessions.
- Errors
401 403 422 500 503401Missing or invalid API key or execution token, or one whose key was deleted or whose token expired.403Your organization does not have Support API access. Contact Parahelp to enable it.422Request validation error. The query parameters are invalid.500Internal server error. Sessions could not be listed.503Session search is unavailable, so sessions could not be looked up by environment variable. Try again shortly.
List agent profiles
/api/v0/support/agent-profiles BetaList your organization’s API agent profiles: the agent profiles that run on sessions from this API. Agent profiles are created through Parahelp; ask it for one that runs on API sessions.
Each defines a customer agent with its tools and memory. Select one for a session by its agent_profile_id with a session updated event. Returns up to 1,000 current API agent profiles in one response, without pagination.
curl https://external-api.parahelp.com/api/v0/support/agent-profiles \
-H "Authorization: Bearer $PARAHELP_API_KEY"Responses
200Up to 1,000 of the organization’s API agent profiles.agent_profilesarray of objects requiredUp to 1,000 of the organization’s currently configured API agent profiles.
agent_profile_idstring requiredThe id to select this agent profile for a session.
typestring · always api requiredThe source the agent profile’s sessions come from.
agent_namestring requiredThe name of the customer agent the agent profile runs.
descriptionstring requiredWhat the agent profile is for, as configured.
- Errors
401 403 500401Missing or invalid API key or execution token, or one whose key was deleted or whose token expired.403Your organization does not have Support API access. Contact Parahelp to enable it.500Internal server error. Agent profiles could not be listed.
Generated from the OpenAPI spec, version 0.2.0.