The Amp External API allows integrations to interact with Amp workspace data. All data access is scoped to the Amp workspace that owns the provided client credentials. If your workspace has a required custom domain, send API requests to https://YOUR_WORKSPACE_DOMAIN/api/v2 instead of https://ampcode.com/api/v2. Use your workspace domain in the request examples below. For Sign in with Amp OAuth, keep resource=https://ampcode.com/api/v2 in the authorization request. To use this API, create a External API Application in your workspace. Right now, only machine-to-machine applications can be created; Sign in with Amp applications are not generally available. For integrations and automations using the Amp product itself, use the Amp CLI or Amp SDK instead.
If your workspace has a required custom domain, use its API URL
instead, for example https://your-workspace.ampcode.app/api/v2.
Authentication
M2M App
Machine-to-machine (M2M) access token from the OAuth 2.0 client credentials flow. Workspace admins create M2M applications in workspace Applications settings and choose the scopes each one may request. The token acts for its whole workspace, limited to those scopes. Thread scopes. 'amp.api:threads:read' includes both 'amp.api:threads.meta:read' and 'amp.api:threads.contents:read'. Every operation and field that requires one of them also accepts it. M2M clients delete threads with 'amp.api:threads:delete'. They cannot create threads. Deprecated scope names. These old names are deprecated aliases. Credentials that carry them keep working, and GET /api/v2/actor returns a credential's scopes under the names it carries. Use the new names: amp.api:workspace.threads.meta:view (now amp.api:threads.meta:read), amp.api:workspace.threads.contents:view (now amp.api:threads.contents:read), amp.api:workspace.threads:manage (now amp.api:threads:delete), amp.api:workspace.analytics:view (now amp.api:workspace.analytics:read), amp.api:workspace.entitlements:view (now amp.api:workspace.entitlements:read), amp.api:workspace.entitlements:manage (now amp.api:workspace.entitlements:write), amp.api:workspace.groups:view (now amp.api:workspace.groups:read), amp.api:workspace.groups:manage (now amp.api:workspace.groups:write), amp.api:workspace.members:view (now amp.api:workspace.members:read), amp.api:workspace.model-provider-keys:view (now amp.api:workspace.model-provider-keys:read), amp.api:workspace.model-provider-keys:manage (now amp.api:workspace.model-provider-keys:write), amp.api:workspace.projects:view (now amp.api:projects:read).
Sign in with Amp
Sign in with Amp OAuth access token. Include resource=https://ampcode.com/api/v2 in the authorization request. Amp requires that resource as the token audience and reads the exact scopes from the signed token. Amp also verifies the registered application, selected workspace, current membership, and user permissions. Workspace admins register Sign in with Amp applications in workspace Applications settings. Thread scopes. 'amp.api:threads:read' includes both 'amp.api:threads.meta:read' and 'amp.api:threads.contents:read'. Every operation and field that requires one of them also accepts it. Deprecated scope names. These old names are deprecated aliases. Credentials that carry them keep working, and GET /api/v2/actor returns a credential's scopes under the names it carries. Use the new names: amp.api:workspace.threads.meta:view (now amp.api:threads.meta:read), amp.api:workspace.threads.contents:view (now amp.api:threads.contents:read), amp.api:workspace.threads:manage (now amp.api:threads:delete), amp.api:workspace.analytics:view (now amp.api:workspace.analytics:read), amp.api:workspace.entitlements:view (now amp.api:workspace.entitlements:read), amp.api:workspace.entitlements:manage (now amp.api:workspace.entitlements:write), amp.api:workspace.groups:view (now amp.api:workspace.groups:read), amp.api:workspace.groups:manage (now amp.api:workspace.groups:write), amp.api:workspace.members:view (now amp.api:workspace.members:read), amp.api:workspace.model-provider-keys:view (now amp.api:workspace.model-provider-keys:read), amp.api:workspace.model-provider-keys:manage (now amp.api:workspace.model-provider-keys:write), amp.api:workspace.projects:view (now amp.api:projects:read).
List threads from your workspace, with optional filtering and pagination. An M2M client lists all threads of its workspace, including private and group-shared threads. A Sign in with Amp access token lists only the threads its user can see in the application’s workspace, as the Amp app lists them: their own threads, threads shared with the workspace or by link, and threads shared with them or their groups; this is experimental, requires access from the Amp team, and is limited for now to the Amp team’s own project, to orderBy=updatedAt with an updatedAfter in the last 25 hours, and to listing without query. Threads are listed by time of first sync in ascending order for sorting stability, unless orderBy says otherwise.
OAuth Scopes
amp.api:threads.meta:read
Query Parameters
limit
Maximum number of results to return.
Typeinteger
Default: 50
cursor
Cursor for pagination to get the next set of results.
Typestring
query
Search query to filter threads by content. A Sign in with Amp access token needs the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope to search.
Typestring
project
Only include threads in this project. Accepts a project ID (UUID) or namespace/name (case insensitive). The project must belong to the workspace. Returns 400 if the project is not found in the workspace.
Typevalue
string · uuid
string
after
Only include threads where the thread's initial sync time is after this date (ISO 8601 format). Not allowed with orderBy=updatedAt.
Typestring · date-time
before
Only include threads where the thread's initial sync time is before this date (ISO 8601 format). Not allowed with orderBy=updatedAt.
Typestring · date-time
updatedAfter
Only include threads last updated after this date (ISO 8601 format). Requires orderBy=updatedAt.
Typestring · date-time
orderBy
Which time to list threads by: firstSyncedAt, the initial sync time (default), which keeps pages stable, or updatedAt, the last update time, to find recently active threads. A thread that is updated while you page by updatedAt moves, so it can appear on two pages or on none; dedupe by id.
TypestringfirstSyncedAt | updatedAt
sort
Sort order for results. ASC = oldest first (default), DESC = newest first.
TypestringASC | DESC
visibility
Only include threads with this sharing setting: private (only the creator, plus anyone it is shared with directly), group_shared (shared with groups), workspace_shared (every workspace member), or public_unlisted (anyone with the link). Use workspace_shared to leave out threads that not every member can read.
Comma-separated thread field names to return, such as title,updatedAt,stats; id is always returned. A field the credential cannot read stays absent. Unknown names return 400.
Typestring
userEmail
Only include threads created by the user with this email address. The user must be a current workspace member or have created threads in the workspace, such as a former member. Not allowed with a Sign in with Amp access token; use userID.
Typestring · email
userID
Only include threads created by the user with this user ID. For an M2M client, the user must be a current workspace member or have created threads in the workspace, such as a former member.
Pagination cursor for getting the next set of results.
threadsREQUIRED
array
Array of threads matching the query
Items
object
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Start a thread in a project and send its first user message. M2M clients cannot create threads. A Sign in with Amp token starts threads only in projects of the application's workspace that the user can use, and each call rechecks the user's current grant to the application. The thread is owned by the signed-in user and runs in an orb as them: the agent uses their access, credentials, and Amp credits, and is not limited to the token's other scopes. The response returns once the thread is accepted; the agent keeps working after it.
OAuth Scopes
amp.api:threads:write
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
projectREQUIRED
value
Project to start the thread in. Accepts a project ID (UUID) or namespace/name (case insensitive). The token owner must be able to use the project: their own project, or a project of a workspace they belong to. The thread belongs to the project’s workspace, or to no workspace for a personal project.
string · uuid
string
messageREQUIRED
string
Text of the first user message. The agent starts working on it immediately.
agentMode
string
Agent mode key, such as medium. Must be a mode the token owner can use in the project. Omit for the default mode.
title
string
Thread title. Omit to let Amp generate one from the conversation.
labels
array
Labels to attach to the thread, at most 20. Names are lowercased and must be alphanumeric with hyphens.
400Invalid request body, or an agent mode or label that cannot be used
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
401Unauthorized
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
402The token owner is out of credits
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
403Forbidden: missing amp.api:threads:write, a Sign in with Amp application or user without access, or a workspace policy does not let the token start an orb or, when it requires a recent sign-in, any thread, or allows threads only from the Amp web app and from orbs
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
404Project not found, the token owner cannot use it, or it is outside the token's workspace (for a Sign in with Amp token, the application's workspace)
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
429The token owner created more than 100 threads in the current minute
Streams live changes to the threads that GET /api/v2/workspace/threads lists for a Sign in with Amp access token, as Server-Sent Events (text/event-stream), so an application can keep its list current without polling. Each stream starts with a thread event for every thread in its snapshot, then ready, then a thread event whenever a thread is created or its title, agent state, archived state, or read state changes. It covers the user’s own threads updated in the last 24 hours, in the threads the list would return, and not threads that others shared with the user; list those with GET /api/v2/workspace/threads. The server closes each stream after about 60 seconds so access is checked again; reconnect and merge the new snapshot. This is experimental and has the same access requirements as listing with a Sign in with Amp token.
One Server-Sent Event of GET /api/v2/workspace/threads/events, sent as data: <JSON>.
object
A thread was created or changed, or is in the stream’s first snapshot. Merge it by id; an id you have not listed is a new thread.
typeREQUIRED
stringthread
threadREQUIRED
object
The current values of a thread’s fields that change while it runs.
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
updatedAtREQUIRED
string · date-time
When the thread was last updated.
archivedREQUIRED
boolean
Whether the thread is archived.
agentStateREQUIRED
object
What the thread’s agent is doing now. Unlike the list, this does not trail the agent.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
unreadREQUIRED
boolean
Whether the thread has a message not from the user since they last read it.
object
The first snapshot is complete; later thread events are changes.
List the threads the token owner created, most recently updated first, as the Amp app's sidebar and the CLI list them: their personal threads and their threads in workspaces they still belong to. Archived and empty threads are left out. A Sign in with Amp access token needs the same scopes and lists only the user's threads in the application's workspace, without their personal threads, and each call rechecks the user's current grant to the application. M2M clients list a workspace's threads with GET /api/v2/workspace/threads instead. Threads that others shared with the token owner are not listed, though the token can read them by ID. Pages are offsets into the list at the time of each request, so a thread that is updated while you page can appear on two pages or on none; dedupe by id.
OAuth Scopes
amp.api:threads.meta:read
Query Parameters
limit
Maximum number of results to return.
Typeinteger
Default: 50
cursor
Cursor for pagination to get the next set of results.
Pagination cursor for getting the next set of results.
threadsREQUIRED
array
Array of threads matching the query
Items
object
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Get one thread by ID. Returns the same thread object as the thread list, including its creator (creatorUserID) and its agent state (agentState), which a client can poll to follow a thread it created. An M2M client reads every thread of its workspace, including private and group-shared threads. Every credential needs 'amp.api:threads.meta:read', plus 'amp.api:threads.contents:read' for the contents fields; amp.api:threads:read includes both. A Sign in with Amp access token reads only the threads its user can find in their thread lists in the application's workspace, never their personal threads or other workspaces' threads, and never as a workspace or site admin. Each call rechecks the user's current grant to the application. For the orb of a self-hosted orb provider, the thread ID is T- followed by the UUID in ORB_ID (amp-<uuid>), and archived tells a paused orb whose thread was archived from one whose thread is only idle.
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
urlREQUIRED
string
The normalized URL to the repository (e.g., https://github.com/owner/repo). Normalization is not guaranteed (e.g., for obscure or ambiguous SSH Git remote URL formats), so you should inspect for outliers.
dir
string
The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository.
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
string
subThreads
array
Sub-threads belonging to this thread.
Items
v2.Thread
A conversation thread in Amp
idREQUIRED
string
Unique identifier for the thread.
title
string
Title of the thread. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
createdAt
string · date-time
When the thread was created.
updatedAt
string · date-time
When the thread was last updated.
firstSyncedAt
string · date-time
When the thread was first synced.
creatorUserIDREQUIRED
string
User ID of the thread creator.
archived
boolean
Whether the thread is archived.
agentState
object
Last state the thread’s agent reported, which can trail the agent by about 10 seconds. Unset until the agent first reports, so a thread just created has none; keep polling until it is set.
stateREQUIRED
stringworking | idle | awaiting_approval | error
working: the agent is running a turn. idle: the agent finished its turn and waits for the next message. awaiting_approval: the agent waits for a person to approve a tool call. error: the turn stopped on an error; Amp may retry it on its own.
updatedAtREQUIRED
string · date-time
When the agent reported this state.
stats
object
Message counts of the thread.
messageCountREQUIRED
integer
Number of messages in the thread, counting user messages, assistant messages, and tool results.
userMessageCountREQUIRED
integer
Number of user messages with text or an image, not counting tool results. Includes messages that other threads, plugins, or automations sent to the thread. May be 0 for old threads.
lastUserMessageAt
string · date-time
When the last user message was sent, not counting messages that another thread sent. Unset if the thread has none.
pinned
boolean
Unset for M2M clients.
unread
boolean
Whether the thread has a message not from the user since they last read it, as the Amp app’s thread lists show it.
lastReadAt
string · date-time
When the user last read the thread.
hostname
string
Hostname of the machine running a local CLI or runner executor. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
mainThreadID
string
ID of the main thread, if this is a sub-thread
parentThreadID
string
ID of the thread whose execution created this thread (for example a child thread spawned by another thread with create_thread, by Puck, or by a plugin). Unset for threads without a parent, and becomes unset if the parent thread is deleted. A creating thread in another workspace is not returned.
repositories
array
Repositories in which this thread started working. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Items
object
labels
array
Normalized label names attached to the thread, sorted alphabetically. An empty array means the thread has no labels. Only returned if the credential has the 'amp.api:threads.contents:read' or 'amp.api:threads:read' scope.
Get the messages belonging to a thread, oldest first. An M2M client reads the threads of its workspace. Every credential needs 'amp.api:threads.contents:read' (or amp.api:threads:read, which includes it). A Sign in with Amp access token reads only the threads its user can find in their thread lists in the application's workspace, never their personal threads or other workspaces' threads, and never as a workspace or site admin. Each call rechecks the user's current grant to the application.
OAuth Scopes
amp.api:threads.contents:read
Path Parameters
threadIDREQUIRED
ID of the target thread, with the format "T-...".
Typestring
Query Parameters
limit
Maximum number of results to return.
Typeinteger
Default: 50
cursor
Cursor for pagination to get the next set of results.
Pagination cursor for getting the next set of results.
messagesREQUIRED
array
Array of message objects in the thread. Each message includes a stable messageID, numeric messageVersion, and createdAt timestamp when available. Other message fields are currently not stable and may change at any time. For scanning purposes, we recommend checking the entire content of each message.
Items
value
Example
{
"nextCursor": "string",
"messages": [
null
]
}
400Invalid thread ID or query parameters
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
401Unauthorized
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
403Forbidden: missing client scope(s)
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
404Thread not found, or the credential cannot read it
Send a follow-up user message to a thread, which the agent answers with the thread's earlier conversation as context. Only the token owner's own orb threads accept it, such as the threads it created with POST /api/v2/threads. A Sign in with Amp token reaches only the user's threads in the application's workspace, and each call rechecks the user's current grant to the application. If the agent is still working, the message waits in the thread's queue and the agent answers it after its current turn, so you need not wait for idle before posting. The agent acts as the token owner, with their access, credentials, and Amp credits. The response returns once the thread accepts the message; poll GET /api/v2/threads/{threadID}/metadata until agentState.state is idle, then read the reply after messageID in GET /api/v2/threads/{threadID}/messages.
OAuth Scopes
amp.api:threads:write
Path Parameters
threadIDREQUIRED
ID of the target thread, with the format "T-...".
Typestring
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
messageREQUIRED
string
Text of the user message. The agent answers it with the conversation so far as context.
403Forbidden: missing amp.api:threads:write, or a workspace policy does not let the token start an orb or allows threads only from the Amp web app and from orbs
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
404Thread not found, or not an orb thread that the token owner owns, or outside a Sign in with Amp application's workspace. Threads shared with the owner are not accepted.
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
409The thread is archived
Response Body
Content Typeapplication/json
Typeobject
errorREQUIRED
string
Error message describing what went wrong
Example
{
"error": "string"
}
429The token owner posted more than 100 messages in the current minute
Get usage information for a thread. Thread usage data is only available for threads created less than 180 days ago in Enterprise workspaces, or less than 90 days ago in other workspaces.
Always empty. Kept for compatibility; usage covers only this thread.
Items
string
usageREQUIRED
number
Total thread cost in USD over the thread's whole life, including orb and tool usage. Counts usage paid with any credits, including free or promotional credits and subscriptions, but not the free tier.
orbUsageREQUIRED
number
Orb usage of the thread (USD). Included in usage; not included in models.
toolUsageREQUIRED
number
Tool usage of the thread (USD). Included in usage; not included in models.
estimatedProviderCostAtListPriceUSDREQUIRED
number
EXPERIMENTAL. Estimated USD cost of bring-your-own-key (BYOK) inference in this thread, computed from token usage at the model provider’s public list price at the time of the request. This is what the customer would have paid the provider (for example Anthropic or OpenAI) at list price; it is not billed by Amp and is not included in the usage field. Values can include fractions of a cent; round only for display after summing. This is only an estimate. Amp cannot see negotiated pricing, discounts, committed-use contracts, or free-tier allowances a customer has with a provider, and the estimate does not include markups or fees charged by AI routers or gateways. Requests sent through an AI router connection (for example OpenRouter) are not estimated at all and contribute 0, because Amp has no list price for router-served models. Requests served through subscription connections (such as ChatGPT or Claude subscriptions) are excluded because they have no per-token provider bill. Requests made before 2026-08-26 are not included. Always 0 for workspaces that do not show BYOK inference cost. Contact Amp support before relying on this value for billing, chargeback, or reporting; its name, semantics, and availability may change without notice.
orbsREQUIRED
array
Orb runtime and usage of the thread by orb size, largest usage first
Items
object
Usage of orbs (Amp-hosted sandboxes that run threads) of one size. Orb usage is included in the enclosing usage total.
sizeREQUIRED
string,null
Orb size, such as "a1.medium", or null when the CPU and memory match no current orb size
cpuCountREQUIRED
number,null
vCPUs of the orb, or null if unknown
memoryMBREQUIRED
number,null
Memory of the orb in MB, or null if unknown
runtimeMsREQUIRED
number
Billed orb runtime in milliseconds, whichever credits paid for it. Runtime paid for by credits that the enclosing usage total excludes, such as personal subscriptions, counts here but not in usage.
usageREQUIRED
number
Orb usage (USD), counted the same way as the enclosing usage total
toolsREQUIRED
array
Tool calls and usage of the thread by tool, largest usage first
Items
object
Usage of one tool that Amp charges per call, separately from model usage. Tool usage is included in the enclosing usage total.
toolREQUIRED
string
Tool name, such as "web_search" or "read_web_page"
callsREQUIRED
number
Number of charged calls, whichever credits paid for them, including calls that cost nothing
usageREQUIRED
number
Tool usage (USD), counted the same way as the enclosing usage total
modelsREQUIRED
array
Per-model usage and cost breakdown for the thread
Items
object
providerREQUIRED
string
Provider identifier for the model usage bucket
modelREQUIRED
string
Model identifier for the model usage bucket
requestsREQUIRED
number
Number of requests for this provider/model
inputTokensREQUIRED
number
Total uncached input tokens for this provider/model
outputTokensREQUIRED
number
Total output tokens for this provider/model
cacheReadInputTokensREQUIRED
number
Total cache-read input tokens for this provider/model
cacheCreationInputTokensREQUIRED
number
Total cache-creation input tokens for this provider/model
usageREQUIRED
number
Total cost in USD for this provider/model
estimatedProviderCostAtListPriceUSDREQUIRED
number
EXPERIMENTAL. Estimated USD cost of bring-your-own-key (BYOK) inference for this provider/model, computed from token usage at the model provider’s public list price at the time of the request. This is what the customer would have paid the provider (for example Anthropic or OpenAI) at list price; it is not billed by Amp and is not included in the usage field. Values can include fractions of a cent; round only for display after summing. This is only an estimate. Amp cannot see negotiated pricing, discounts, committed-use contracts, or free-tier allowances a customer has with a provider, and the estimate does not include markups or fees charged by AI routers or gateways. Requests sent through an AI router connection (for example OpenRouter) are not estimated at all and contribute 0, because Amp has no list price for router-served models. Requests served through subscription connections (such as ChatGPT or Claude subscriptions) are excluded because they have no per-token provider bill. Requests made before 2026-08-26 are not included. Always 0 for workspaces that do not show BYOK inference cost. Contact Amp support before relying on this value for billing, chargeback, or reporting; its name, semantics, and availability may change without notice.
List all members in the workspace. A Sign in with Amp user sees the member list only when they are a workspace member and the workspace allows members to view the member list.
Search commit messages and author names without case sensitivity in history order. At most 2,000 commits are scanned per request; path filters history. Continue with nextCursor to scan further. Cursor pagination pins an immutable commit and binds project and query. Requires current repository access for delegated users, or a workspace-owned repository for M2M clients.
Search repository contents using a regular expression. Maximum 500 collected lines and 50 matches per file. Results can be incomplete even when no next page is available; incomplete is always true. Cursor pagination pins an immutable commit and binds project and query. Requires current repository access for delegated users, or a workspace-owned repository for M2M clients.
Search repository-relative file paths with case-sensitive matching. Glob syntax: * and ? within one segment, ** across segments; no braces or character classes. At most 20,000 entries or 2,000,000 pattern-character comparisons are scanned per request; continue with nextCursor to scan further. A single path exceeding the comparison budget returns 422. Cursor pagination pins an immutable commit and binds project and query. Requires current repository access for delegated users, or a workspace-owned repository for M2M clients.
Compare a commit to its parent, or compare it against the merge base of an explicit base. All patches and filtered-file records returned by storage are included without additional truncation. Files over 500 KB, files with over 2,000 changed lines, binary files, and lock files have no inline patch. Check filteredFiles and incomplete for omitted patches.
Read a file (base64, at most 1 MiB), or list a directory with stable pagination. Path is repository-relative and can span multiple URL segments. Set recursive=true to list the full subtree. Cursors bind the project, path, options, and immutable commit.
Branch, tag, or commit; resolved to a commit before reading.
Typestring
recursive
List all descendants instead of direct children.
Typestringtrue | false
Default: "false"
limit
Typeinteger
Default: 100
cursor
Opaque continuation cursor. Keep the same project, path, and query. Cursors remain bound to the client. Every request must independently authorize access.
Typestring
HTTP Request
curl 'https://ampcode.com/api/v2/workspace/projects/00000000-0000-4000-8000-000000000000/repository/contents?ref=main&recursive=false&limit=100' \
--request GET \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json'
# Or use @namespace/name
curl 'https://ampcode.com/api/v2/workspace/projects/@my-workspace/my-project/repository/contents?ref=main&recursive=false&limit=100' \
--request GET \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json'
Read a file (base64, at most 1 MiB), or list a directory with stable pagination. Path is repository-relative and can span multiple URL segments. Set recursive=true to list the full subtree. Cursors bind the project, path, options, and immutable commit.
Branch, tag, or commit; resolved to a commit before reading.
Typestring
recursive
List all descendants instead of direct children.
Typestringtrue | false
Default: "false"
limit
Typeinteger
Default: 100
cursor
Opaque continuation cursor. Keep the same project, path, and query. Cursors remain bound to the client. Every request must independently authorize access.
Typestring
HTTP Request
curl 'https://ampcode.com/api/v2/workspace/projects/00000000-0000-4000-8000-000000000000/repository/contents/README.md?ref=main&recursive=false&limit=100' \
--request GET \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json'
# Or use @namespace/name
curl 'https://ampcode.com/api/v2/workspace/projects/@my-workspace/my-project/repository/contents/README.md?ref=main&recursive=false&limit=100' \
--request GET \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json'
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
membersREQUIRED
array
Members assigned to the workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
name
string
Full name of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
email
string · email
Primary email address of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
Create a workspace group. Initial members are removed from any other workspace group.
OAuth Scopes
amp.api:workspace.groups:write
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
nameREQUIRED
string
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
members
array
Initial group members. Listed users are removed from any other workspace group.
Default: []
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
membersREQUIRED
array
Members assigned to the workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
name
string
Full name of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
email
string · email
Primary email address of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
membersREQUIRED
array
Members assigned to the workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
name
string
Full name of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
email
string · email
Primary email address of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
membersREQUIRED
array
Members assigned to the workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
name
string
Full name of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
email
string · email
Primary email address of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
Replace a workspace group membership list. After this request succeeds, this group has exactly the listed members; omitted users are removed from this group, and listed users are removed from any other workspace group.
OAuth Scopes
amp.api:workspace.groups:write
Path Parameters
groupIDREQUIRED
ID of the target workspace group.
Typestring · uuid
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
membersREQUIRED
array
Full replacement membership list. After the request succeeds, this group has exactly these members, and listed users are removed from any other workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
membersREQUIRED
array
Members assigned to the workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
name
string
Full name of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
email
string · email
Primary email address of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
Add, move, or update roles for members in a workspace group. Existing group members not listed remain assigned to this group, and listed users are removed from any other workspace group.
OAuth Scopes
amp.api:workspace.groups:write
Path Parameters
groupIDREQUIRED
ID of the target workspace group.
Typestring · uuid
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
membersREQUIRED
array
Members whose group assignment or role should be updated. Existing group members not listed remain assigned to this group, and listed users are added to this group and removed from any other workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
200Workspace group members added, moved, or updated
Response Body
Content Typeapplication/json
Typeobject
groupREQUIRED
object
Workspace group.
idREQUIRED
string · uuid
Unique identifier for the workspace group.
nameREQUIRED
string
Workspace group name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
membersREQUIRED
array
Members assigned to the workspace group.
Items
object
userIDREQUIRED
string
Workspace member user ID.
roleREQUIRED
stringcaptain | member
Role of the user in the workspace group. Captains can manage their group.
name
string
Full name of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
email
string · email
Primary email address of the user. Only returned if the client has the "amp.api:workspace.members:read" scope.
Workspace entitlement name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
typeREQUIRED
stringpaid_credits
Resource type limited by this entitlement.
usageLimitUSDREQUIRED
integer
Dollar-denominated credit cap in whole US dollars.
windowDaysREQUIRED
value
Fixed quota window in days. Supported values are 1, 7, and 30.
number1
number7
number30
assignmentREQUIRED
one of
Who receives this entitlement.
object
typeREQUIRED
stringdefault
Apply this entitlement to workspace members without a more specific entitlement.
object
typeREQUIRED
stringusers
userIDsREQUIRED
array
Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments.
Items
string
Workspace member user ID.
object
typeREQUIRED
stringworkspace_groups
workspaceGroupIDsREQUIRED
array
Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments.
Items
string · uuid
Workspace group ID.
object
typeREQUIRED
stringunmanaged
This entitlement uses an assignment mechanism not managed by this API.
Create a workspace entitlement for dollar-denominated credit caps. Assignments can target default workspace members, direct users, or workspace groups.
OAuth Scopes
amp.api:workspace.entitlements:write
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
nameREQUIRED
string
Workspace entitlement name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
usageLimitUSDREQUIRED
integer
Dollar-denominated credit cap in whole US dollars.
windowDaysREQUIRED
value
Fixed quota window in days. Supported values are 1, 7, and 30.
number1
number7
number30
assignmentREQUIRED
one of
Who receives this entitlement.
object
typeREQUIRED
stringdefault
Apply this entitlement to workspace members without a more specific entitlement.
object
typeREQUIRED
stringusers
userIDsREQUIRED
array
Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments.
Items
string
Workspace member user ID.
object
typeREQUIRED
stringworkspace_groups
workspaceGroupIDsREQUIRED
array
Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments.
Workspace entitlement name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
typeREQUIRED
stringpaid_credits
Resource type limited by this entitlement.
usageLimitUSDREQUIRED
integer
Dollar-denominated credit cap in whole US dollars.
windowDaysREQUIRED
value
Fixed quota window in days. Supported values are 1, 7, and 30.
number1
number7
number30
assignmentREQUIRED
one of
Who receives this entitlement.
object
typeREQUIRED
stringdefault
Apply this entitlement to workspace members without a more specific entitlement.
object
typeREQUIRED
stringusers
userIDsREQUIRED
array
Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments.
Items
string
Workspace member user ID.
object
typeREQUIRED
stringworkspace_groups
workspaceGroupIDsREQUIRED
array
Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments.
Items
string · uuid
Workspace group ID.
object
typeREQUIRED
stringunmanaged
This entitlement uses an assignment mechanism not managed by this API.
Workspace entitlement name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
typeREQUIRED
stringpaid_credits
Resource type limited by this entitlement.
usageLimitUSDREQUIRED
integer
Dollar-denominated credit cap in whole US dollars.
windowDaysREQUIRED
value
Fixed quota window in days. Supported values are 1, 7, and 30.
number1
number7
number30
assignmentREQUIRED
one of
Who receives this entitlement.
object
typeREQUIRED
stringdefault
Apply this entitlement to workspace members without a more specific entitlement.
object
typeREQUIRED
stringusers
userIDsREQUIRED
array
Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments.
Items
string
Workspace member user ID.
object
typeREQUIRED
stringworkspace_groups
workspaceGroupIDsREQUIRED
array
Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments.
Items
string · uuid
Workspace group ID.
object
typeREQUIRED
stringunmanaged
This entitlement uses an assignment mechanism not managed by this API.
Update provided workspace entitlement fields. If assignment is provided, it replaces the entitlement assignment.
OAuth Scopes
amp.api:workspace.entitlements:write
Path Parameters
entitlementIDREQUIRED
ID of the target workspace entitlement.
Typestring · uuid
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
name
string
Workspace entitlement name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
usageLimitUSD
integer
Dollar-denominated credit cap in whole US dollars.
windowDays
value
Fixed quota window in days. Supported values are 1, 7, and 30.
number1
number7
number30
assignment
one of
Who receives this entitlement. If provided, this replaces the entitlement assignment; userIDs and workspaceGroupIDs are full replacement lists, not incremental additions.
object
typeREQUIRED
stringdefault
Apply this entitlement to workspace members without a more specific entitlement.
object
typeREQUIRED
stringusers
userIDsREQUIRED
array
Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments.
Items
string
Workspace member user ID.
object
typeREQUIRED
stringworkspace_groups
workspaceGroupIDsREQUIRED
array
Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments.
Workspace entitlement name. Use 3 to 32 letters, numbers, and hyphens, starting and ending with a letter or number. Names keep their case and are unique in the workspace ignoring case.
typeREQUIRED
stringpaid_credits
Resource type limited by this entitlement.
usageLimitUSDREQUIRED
integer
Dollar-denominated credit cap in whole US dollars.
windowDaysREQUIRED
value
Fixed quota window in days. Supported values are 1, 7, and 30.
number1
number7
number30
assignmentREQUIRED
one of
Who receives this entitlement.
object
typeREQUIRED
stringdefault
Apply this entitlement to workspace members without a more specific entitlement.
object
typeREQUIRED
stringusers
userIDsREQUIRED
array
Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments.
Items
string
Workspace member user ID.
object
typeREQUIRED
stringworkspace_groups
workspaceGroupIDsREQUIRED
array
Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments.
Items
string · uuid
Workspace group ID.
object
typeREQUIRED
stringunmanaged
This entitlement uses an assignment mechanism not managed by this API.
A workspace model provider (BYOK) key. Inference for a provider uses the workspace key that is currently active for that provider.
object
providerREQUIRED
stringmeta
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringanthropic
Anthropic API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringopenai
OpenAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
configREQUIRED
object
openAIRegion
stringglobal | us | eu | au | ca | jp | in | sg | kr | gb | ae
OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces.
Default: "global"
object
providerREQUIRED
stringxai
SpaceXAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
Create a workspace model provider (BYOK) key. Keys are created inactive unless active is true. Activating a key does not deactivate other keys. To rotate a key, create a new active key with the same configuration, then deactivate or delete the old key.
OAuth Scopes
amp.api:workspace.model-provider-keys:write
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeone of
object
providerREQUIRED
stringmeta
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
apiKeyREQUIRED
string
Provider API key secret. Stored encrypted and never returned by this API.
active
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
Default: false
object
providerREQUIRED
stringanthropic
Create an Anthropic API key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
apiKeyREQUIRED
string
Provider API key secret. Stored encrypted and never returned by this API.
active
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
Default: false
object
providerREQUIRED
stringopenai
Create an OpenAI API key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
apiKeyREQUIRED
string
Provider API key secret. Stored encrypted and never returned by this API.
active
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
Default: false
config
object
OpenAI-specific configuration. Defaults to the global region.
openAIRegion
stringglobal | us | eu | au | ca | jp | in | sg | kr | gb | ae
OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces.
Default: "global"
object
providerREQUIRED
stringxai
Create a SpaceXAI API key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
apiKeyREQUIRED
string
Provider API key secret. Stored encrypted and never returned by this API.
active
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringanthropic
Anthropic API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringopenai
OpenAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
configREQUIRED
object
openAIRegion
stringglobal | us | eu | au | ca | jp | in | sg | kr | gb | ae
OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces.
Default: "global"
object
providerREQUIRED
stringxai
SpaceXAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringanthropic
Anthropic API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringopenai
OpenAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
configREQUIRED
object
openAIRegion
stringglobal | us | eu | au | ca | jp | in | sg | kr | gb | ae
OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces.
Default: "global"
object
providerREQUIRED
stringxai
SpaceXAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
Update provided workspace model provider (BYOK) key fields. The key secret cannot be updated in place: to rotate a key, create a new key with the new secret and active set to true, then delete the old key.
OAuth Scopes
amp.api:workspace.model-provider-keys:write
Path Parameters
keyIDREQUIRED
ID of the target workspace model provider key.
Typestring · uuid
Header Parameters
Content-TypeREQUIRED
Must be application/json
Typestring
Request Body
Content Typeapplication/json
Typeobject
name
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
active
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
config
object
Provider-specific configuration. Only supported for openai keys.
openAIRegion
stringglobal | us | eu | au | ca | jp | in | sg | kr | gb | ae
OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces.
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringanthropic
Anthropic API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
object
providerREQUIRED
stringopenai
OpenAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
createdAtREQUIRED
string · date-time
When the key was created.
updatedAtREQUIRED
string · date-time
When the key was last updated.
configREQUIRED
object
openAIRegion
stringglobal | us | eu | au | ca | jp | in | sg | kr | gb | ae
OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces.
Default: "global"
object
providerREQUIRED
stringxai
SpaceXAI API key.
idREQUIRED
string · uuid
Unique identifier for the workspace model provider key.
nameREQUIRED
string
Display name for the model provider key. Names do not need to be unique; use the key ID to identify a key.
redactedKeyREQUIRED
string,null
Redacted display form of the stored API key, such as "sk-ant-api••••1234".
activeREQUIRED
boolean
Whether this key is eligible for inference. Multiple keys for the same provider can be active. Model mappings and connection priority determine which key is used.
lastUsedAtREQUIRED
string,null · date-time
When the key was last used for inference, with roughly 30-second granularity.
Daily usage metrics for the workspace. Paid usage amounts in USD retain each credit allocation's original dollar value, even if the workspace later changes credit units.
metadataREQUIRED
object
Metadata about the usage period
startDateREQUIRED
string · date
Start date of the period
endDateREQUIRED
string · date
End date of the period
activeUsersREQUIRED
number
Users with non-zero usage in the period
totalUsersREQUIRED
number
Total distinct users represented in the period, including former members with workspace-attributed usage
totalUsageREQUIRED
number
Total usage in the period (USD), including orb and tool usage
totalOrbUsageREQUIRED
number
Total orb usage in the period (USD)
totalToolUsageREQUIRED
number
Total tool usage in the period (USD)
dataREQUIRED
array
Daily usage data for each day in the period
Items
object
dateREQUIRED
string · date
Date in YYYY-MM-DD format
usersREQUIRED
array
Usage data for users in scope for the period, including users no longer in the workspace if they have usage attributed to this workspace
Items
object
userREQUIRED
object
User information
idREQUIRED
string
User ID
email
string · email
User email - only returned if the client has the "amp.api:workspace.members:read" scope
metricsREQUIRED
object
Usage metrics for the user
linesAddedREQUIRED
number
Lines added by the user
linesDeletedREQUIRED
number
Lines deleted by the user
linesModifiedREQUIRED
number
Lines modified by the user
usageREQUIRED
number
Usage for the user on that day (USD), including orb and tool usage. Counts only usage attributed to the workspace and paid with paid credits; excludes usage paid with free or promotional credits, subscriptions, or the free tier.
orbUsageREQUIRED
number
Workspace-attributed orb usage for the user on that day (USD). Included in usage; not included in models.
toolUsageREQUIRED
number
Workspace-attributed tool usage for the user on that day (USD). Included in usage; not included in models.
estimatedProviderCostAtListPriceUSDREQUIRED
number
EXPERIMENTAL. Estimated USD cost of bring-your-own-key (BYOK) inference by the user on that day, computed from token usage at the model provider’s public list price at the time of the request. This is what the customer would have paid the provider (for example Anthropic or OpenAI) at list price; it is not billed by Amp and is not included in the usage field. Values can include fractions of a cent; round only for display after summing. This is only an estimate. Amp cannot see negotiated pricing, discounts, committed-use contracts, or free-tier allowances a customer has with a provider, and the estimate does not include markups or fees charged by AI routers or gateways. Requests sent through an AI router connection (for example OpenRouter) are not estimated at all and contribute 0, because Amp has no list price for router-served models. Requests served through subscription connections (such as ChatGPT or Claude subscriptions) are excluded because they have no per-token provider bill. Requests made before 2026-08-26 are not included. Always 0 for workspaces that do not show BYOK inference cost. Contact Amp support before relying on this value for billing, chargeback, or reporting; its name, semantics, and availability may change without notice.
modelsREQUIRED
object
Per-model request and token counts for the user
orbsREQUIRED
array
Workspace-attributed orb runtime and usage for the user by orb size, largest usage first
Items
object
Usage of orbs (Amp-hosted sandboxes that run threads) of one size. Orb usage is included in the enclosing usage total.
sizeREQUIRED
string,null
Orb size, such as "a1.medium", or null when the CPU and memory match no current orb size
cpuCountREQUIRED
number,null
vCPUs of the orb, or null if unknown
memoryMBREQUIRED
number,null
Memory of the orb in MB, or null if unknown
runtimeMsREQUIRED
number
Billed orb runtime in milliseconds, whichever credits paid for it. Runtime paid for by credits that the enclosing usage total excludes, such as personal subscriptions, counts here but not in usage.
usageREQUIRED
number
Orb usage (USD), counted the same way as the enclosing usage total
toolsREQUIRED
array
Workspace-attributed tool calls and usage for the user by tool, largest usage first
Items
object
Usage of one tool that Amp charges per call, separately from model usage. Tool usage is included in the enclosing usage total.
toolREQUIRED
string
Tool name, such as "web_search" or "read_web_page"
callsREQUIRED
number
Number of charged calls, whichever credits paid for them, including calls that cost nothing
usageREQUIRED
number
Tool usage (USD), counted the same way as the enclosing usage total
Return the authenticated actor ID, type, and Amp permission scopes granted to the presented credential. Does not return workspace data. Sign in with Amp OIDC ID tokens are not accepted; send the OAuth access token. Scopes do not grant access beyond current resource permissions.