Facts
application/x-www-form-urlencoded application/json Arguments
Required arguments
tokenstringRequiredAuthentication token bearing the code_channels:manage scope. Must be a granular bot token.
xxxx-xxxxxxxxx-xxxxnamestringRequiredA friendly display name for the code channel. Optional when origin_channel_id and origin_message_ts are provided — in that case the channel is named from the origin message and re-titled automatically. Required when no origin link is given.
Help me debug auth flowOptional arguments
team_idstringOptionalEncoded team id to create the channel in. Required for org tokens when origin_channel_id is not provided. When omitted, the workspace is derived from the origin channel.
T1234567890session_idstringOptionalAn opaque identifier for the agent session. When provided, the call is idempotent: if a channel already exists for this session_id, it is returned instead of creating a new one.
ses_abc123is_privatebooleanOptionalWhether the code channel is private. When omitted, the channel matches the privacy of origin_channel_id, or is public if no origin is given. An explicit value is always honored, even if it differs from the origin channel's privacy: passing false creates a public channel from a private origin.
trueorigin_channel_idstringOptionalThe channel ID where the agent session was initiated from. Must be provided together with origin_message_ts. The channel must be accessible to the calling user and must not be externally shared (Slack Connect). When team_id is omitted with an org token, the channel is created in the same workspace as this origin channel.
C1234567890origin_message_tsstringOptionalThe message timestamp in the origin channel that started the agent session. Must be provided together with origin_channel_id. The author of this message is automatically invited to the newly created code channel.
1234567890.123456Usage info
Your app can create a code channel from any message, but the most common flow is: a user @-mentions your agent, your app receives the app_mention event, and, when the request implies multi-step work, your app calls this method to spin up a dedicated channel automatically. Judge that from the request and its context; users shouldn't have to ask for a channel by name.
This method accepts bot tokens only. The calling bot user becomes the channel's agent. Calls with user tokens are rejected.
Pass origin_channel_id and origin_message_ts to link the session back to the triggering message. Slack automatically invites the author of the origin message to the new code channel; your app does not need to invite them separately. When you provide an origin link and omit is_private, Slack also sets the channel's privacy to match the origin channel and allows users who are members of the origin channel to join the code channel. This is the recommended default; it means the right people can find and follow the session without your app needing to manage invites.
If you pass is_private explicitly, Slack uses that value instead of the origin channel's privacy. For example, is_private: false creates a public code channel even when the origin message is in a private channel, so only set it when your app intends to override the origin's privacy.
The origin link must refer to a valid, accessible channel and an existing message. The origin link is recorded on the channel as the origin_link property, connecting the session back to the conversation it started from. If either origin_channel_id or origin_message_ts cannot be resolved, the request fails with invalid_origin_link and no channel is created.
When session_id is provided, the call is idempotent. If a channel already exists for that session, it is returned instead of creating a new one. This lets agent processes reconnect to their channel across retries or restarts.
The calling bot user is automatically attributed as the channel's agent and invited to the channel as part of creation.
Example request
POST /api/agents.conversations.create
{
"name": "Migrate billing cron to Temporal",
"session_id": "ses_8675309",
"origin_channel_id": "C1234567890",
"origin_message_ts": "1717171717.123456"
}
Workspace selection on Enterprise Grid
On an Enterprise Grid org, a channel lives in a specific workspace, so the method has to pick one:
- Workspace-level tokens always create the channel in the token's workspace. The
team_idis not needed; if you do send it, it must match the token's workspace or the call fails withteam_not_found. - Org-level app tokens with
team_idcreate the channel in that workspace. The workspace must belong to the caller's org (team_not_foundis returned otherwise), and your app must be granted access to it (app_not_installed_on_teamis returned otherwise). - Org-level app tokens without
team_idderive a workspace, in order:- The origin channel's workspace, when
origin_channel_idis provided, keeping the code channel next to the conversation it started from. This is the recommended way to omitteam_id. - The creating user's default workspace.
- Any workspace shared by the app and the creating user.
- The origin channel's workspace, when
A fallback workspace is only used if your app has been granted access to it. If no workspace qualifies, the call fails with no_shared_workspace.
Pass team_id explicitly whenever your app knows which workspace the session belongs in; rely on the origin-channel derivation when creating from a mention.
Response
Typical success response
{
"ok": true,
"channel_id": "C9876543210"
}
Typical error response
{
"ok": false,
"error": "feature_disabled"
}
Errors
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok parameter in the response.
access_deniedAccess to a resource specified in the request is denied.
accesslimitedAccess to this method is limited on the current network
account_inactiveAuthentication token is for a deleted user or workspace when using a bot token.
channel_creation_failedThe code channel could not be created.
channel_not_viewableA channel exists for this session but the caller does not have permission to view it.
deprecated_endpointThe endpoint has been deprecated.
ekm_access_deniedAdministrators have suspended the ability to post a message.
enterprise_is_restrictedThe method cannot be called from an Enterprise.
fatal_errorThe server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
feature_disabledThe caller is not authorized to create code channels. The app must be a recognized agent session app, or the user must have the feature enabled.
internal_errorThe server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
invalid_agentThe agent bot user associated with the calling app is not a valid bot.
invalid_arg_nameThe method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
invalid_argumentsThe method was called with invalid arguments.
invalid_array_argThe method was passed an array as an argument. Please only input valid strings.
invalid_authSome aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
invalid_charsetThe method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
invalid_form_dataThe method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
invalid_origin_linkThe origin link is invalid. Either origin_channel_id and origin_message_ts were not provided together, the channel does not exist or is not accessible to the caller, or the message was not found at the given timestamp.
invalid_post_typeThe method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
invite_failedThe channel was created but the agent bot could not be invited.
method_deprecatedThe method has been deprecated.
missing_post_typeThe method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
missing_scopeThe token used is not granted the specific scope permissions required to complete this request.
name_or_origin_requiredA name must be provided unless an origin link (origin_channel_id and origin_message_ts) is given to derive the channel name from.
no_permissionThe workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
no_shared_workspaceNo workspace could be found where both the app and the requesting user are present. The org app must have a workspace grant for at least one workspace the user belongs to.
not_allowed_token_typeThe token type used in this request is not allowed.
not_authedNo authentication token provided.
open_failedThe channel was created but could not be opened in the sidebar.
org_login_requiredThe workspace is undergoing an enterprise migration and will not be available until migration is complete.
origin_channel_externally_sharedThe origin message is in an externally shared (Slack Connect) channel, DM, or group DM. Code channels cannot be created from a Slack Connect conversation.
origin_channel_is_file_channelThe origin message is a comment on a file or canvas. Code channels cannot be created from a file channel — when the canvas belongs to a code channel, continue that session instead.
ratelimitedThe request has been ratelimited. Refer to the Retry-After header for when to retry the request.
request_timeoutThe method was called via a POST request, but the POST data was either missing or truncated.
restricted_actionThe calling user is not permitted to create channels of the requested type in this workspace.
service_unavailableThe service is temporarily unavailable
team_access_not_grantedThe token used is not granted the specific workspace access required to complete this request.
team_added_to_orgThe workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
token_expiredAuthentication token has expired
token_revokedAuthentication token is for a deleted user or workspace or the app has been removed when using a user token.
two_factor_setup_requiredTwo factor setup is required.
user_not_enabledThe author of the origin message does not have the code channels feature enabled.
