{"info":{"title":"Amp External API","version":"v2","description":"The Amp External API allows integrations to interact with Amp workspace data. Currently, this API is only available to Amp Enterprise customers.\n\nAll data access is scoped to the Amp workspace that owns the provided client credentials. Each endpoint verifies the client has the prerequisite OAuth2 scopes for that particular endpoint.\n\nFor integrations and automations using the Amp product itself, use the Amp CLI or SDK instead."},"openapi":"3.0.0","tags":[{"name":"Threads","description":"APIs for working with Amp threads."},{"name":"Workspace","description":"APIs for working with the Amp workspace."}],"servers":[{"url":"https://ampcode.com"}],"security":[{"v2.OAuth2AppAuth":[]}],"components":{"securitySchemes":{"v2.OAuth2AppAuth":{"type":"oauth2","name":"Amp M2M OAuth2 App","flows":{"clientCredentials":{"scopes":{"amp.api:workspace.threads.meta:view":"View basic thread metadata for all threads using the Amp external API","amp.api:workspace.threads.contents:view":"View contents and advanced details of all threads using the Amp external API","amp.api:workspace.threads:manage":"Manage threads using the Amp external API","amp.api:workspace.analytics:view":"View all workspace analytics using the Amp external API","amp.api:workspace.entitlements:view":"View workspace entitlements using the Amp external API","amp.api:workspace.entitlements:manage":"Manage workspace entitlements using the Amp external API","amp.api:workspace.groups:view":"View workspace groups using the Amp external API","amp.api:workspace.groups:manage":"Manage workspace groups using the Amp external API","amp.api:workspace.members:view":"View workspace members and member information using the Amp external API","amp.api:workspace.model-provider-keys:view":"View workspace model provider (BYOK) keys using the Amp external API","amp.api:workspace.model-provider-keys:manage":"Manage workspace model provider (BYOK) keys using the Amp external API"},"tokenUrl":"https://auth.ampcode.com/oauth2/token"}}}},"schemas":{"v2.ErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"},"v2.Repository":{"type":"object","properties":{"url":{"type":"string","description":"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":{"type":"string","description":"The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository."}},"required":["url"],"title":"v2.Repository"},"v2.Thread":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the thread."},"title":{"type":"string","description":"Title of the thread. Only returned if the client has the 'amp.api:workspace.threads.contents:view' scope."},"createdAt":{"type":"string","format":"date-time","description":"When the thread was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the thread was last updated."},"firstSyncedAt":{"type":"string","format":"date-time","description":"When the thread was first synced."},"creatorUserID":{"type":"string","description":"User ID of the thread creator."},"mainThreadID":{"type":"string","description":"ID of the main thread, if this is a sub-thread"},"repositories":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","description":"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":{"type":"string","description":"The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository."}},"required":["url"],"title":"v2.Repository"},"description":"Repositories in which this thread started working. Only returned if the client has the 'amp.api:workspace.threads.contents:view' scope."},"subThreads":{"type":"array","description":"Sub-threads belonging to this thread.","items":{"$ref":"#/components/schemas/v2.Thread"}}},"required":["id","creatorUserID"],"title":"v2.Thread","description":"A conversation thread in Amp"},"v2.ThreadListResponse":{"type":"object","properties":{"nextCursor":{"type":"string","description":"Pagination cursor for getting the next set of results."},"threads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the thread."},"title":{"type":"string","description":"Title of the thread. Only returned if the client has the 'amp.api:workspace.threads.contents:view' scope."},"createdAt":{"type":"string","format":"date-time","description":"When the thread was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the thread was last updated."},"firstSyncedAt":{"type":"string","format":"date-time","description":"When the thread was first synced."},"creatorUserID":{"type":"string","description":"User ID of the thread creator."},"mainThreadID":{"type":"string","description":"ID of the main thread, if this is a sub-thread"},"repositories":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","description":"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":{"type":"string","description":"The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository."}},"required":["url"],"title":"v2.Repository"},"description":"Repositories in which this thread started working. Only returned if the client has the 'amp.api:workspace.threads.contents:view' scope."},"subThreads":{"type":"array","description":"Sub-threads belonging to this thread.","items":{"$ref":"#/components/schemas/v2.Thread"}}},"required":["id","creatorUserID"],"title":"v2.Thread","description":"A conversation thread in Amp"},"description":"Array of threads matching the query"}},"required":["threads"],"title":"v2.ThreadListResponse","description":"Response model for thread list operations"},"v2.ThreadMessagesResponse":{"type":"object","properties":{"nextCursor":{"type":"string","description":"Pagination cursor for getting the next set of results."},"messages":{"type":"array","items":{},"description":"Array of message objects in the thread. Message shapes are currently not stable and may change at any time. For scanning purposes, we recommend checking the entire content of each message."}},"required":["messages"],"title":"v2.ThreadMessagesResponse","description":"Response model for thread messages operations."},"v2.ThreadCostResponse":{"type":"object","properties":{"threadID":{"type":"string","description":"The thread ID"},"subThreadIDs":{"type":"array","items":{"type":"string"},"description":"IDs of sub-threads included in the usage calculation"},"usage":{"type":"number","description":"Total thread cost in USD"},"models":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","description":"Provider identifier for the model usage bucket"},"model":{"type":"string","description":"Model identifier for the model usage bucket"},"requests":{"type":"number","description":"Number of requests for this provider/model"},"inputTokens":{"type":"number","description":"Total uncached input tokens for this provider/model"},"outputTokens":{"type":"number","description":"Total output tokens for this provider/model"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens for this provider/model"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens for this provider/model"},"usage":{"type":"number","description":"Total cost in USD for this provider/model"}},"required":["provider","model","requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","usage"]},"description":"Per-model usage and cost breakdown for the thread"}},"required":["threadID","subThreadIDs","usage","models"],"title":"v2.ThreadCostResponse","description":"Thread usage information"},"v2.WorkspaceMember":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the user"},"name":{"type":"string","description":"Full name of the user"},"email":{"type":"string","format":"email","description":"The primary email address of the user"},"role":{"type":"string","enum":["admin","member"],"description":"Workspace-level role of the user"}},"required":["id","name","email","role"],"title":"v2.WorkspaceMember"},"v2.WorkspaceMembersResponse":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the user"},"name":{"type":"string","description":"Full name of the user"},"email":{"type":"string","format":"email","description":"The primary email address of the user"},"role":{"type":"string","enum":["admin","member"],"description":"Workspace-level role of the user"}},"required":["id","name","email","role"],"title":"v2.WorkspaceMember"},"description":"All members of the workspace"}},"required":["members"],"title":"v2.WorkspaceMembersResponse","description":"Response for workspace members listing"},"v2.WorkspaceGroupMemberRole":{"type":"string","enum":["captain","member"]},"v2.WorkspaceGroupMemberEntry":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"v2.WorkspaceGroupMember":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"v2.WorkspaceGroup":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup"},"v2.WorkspaceGroupsResponse":{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup"},"description":"All groups in the workspace."}},"required":["groups"],"title":"v2.WorkspaceGroupsResponse"},"v2.WorkspaceGroupResponse":{"type":"object","properties":{"group":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup","description":"Workspace group."}},"required":["group"],"title":"v2.WorkspaceGroupResponse"},"v2.CreateWorkspaceGroupBody":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"maxItems":5000,"default":[],"description":"Initial group members. Listed users are removed from any other workspace group."}},"required":["name"],"title":"v2.CreateWorkspaceGroupBody"},"v2.UpdateWorkspaceGroupBody":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."}},"required":["name"],"title":"v2.UpdateWorkspaceGroupBody"},"v2.ReplaceWorkspaceGroupMembersBody":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"maxItems":5000,"description":"Full replacement membership list. After the request succeeds, this group has exactly these members, and listed users are removed from any other workspace group."}},"required":["members"],"title":"v2.ReplaceWorkspaceGroupMembersBody"},"v2.AddWorkspaceGroupMembersBody":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"maxItems":5000,"description":"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."}},"required":["members"],"title":"v2.AddWorkspaceGroupMembersBody"},"v2.WorkspaceEntitlementAssignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]}]},"v2.WorkspaceEntitlementResponseAssignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}]},"v2.WorkspaceEntitlement":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement"},"v2.WorkspaceEntitlementsResponse":{"type":"object","properties":{"entitlements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement"},"description":"All workspace entitlements."}},"required":["entitlements"],"title":"v2.WorkspaceEntitlementsResponse"},"v2.WorkspaceEntitlementResponse":{"type":"object","properties":{"entitlement":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement","description":"Workspace entitlement."}},"required":["entitlement"],"title":"v2.WorkspaceEntitlementResponse"},"v2.CreateWorkspaceEntitlementBody":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]}],"description":"Who receives this entitlement."}},"required":["name","usageLimitUSD","windowDays","assignment"],"title":"v2.CreateWorkspaceEntitlementBody"},"v2.UpdateWorkspaceEntitlementBody":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]}],"description":"Who receives this entitlement. If provided, this replaces the entitlement assignment; userIDs and workspaceGroupIDs are full replacement lists, not incremental additions."}},"title":"v2.UpdateWorkspaceEntitlementBody"},"v2.WorkspaceModelProviderKeyOpenAIConfig":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"},"v2.WorkspaceModelProviderKey":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"A workspace model provider (BYOK) key. Inference for a provider uses the workspace key that is currently active for that provider."},"v2.WorkspaceModelProviderKeysResponse":{"type":"object","properties":{"modelProviderKeys":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"A workspace model provider (BYOK) key. Inference for a provider uses the workspace key that is currently active for that provider."},"description":"All workspace model provider keys."}},"required":["modelProviderKeys"],"title":"v2.WorkspaceModelProviderKeysResponse"},"v2.WorkspaceModelProviderKeyResponse":{"type":"object","properties":{"modelProviderKey":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"Workspace model provider key."}},"required":["modelProviderKey"],"title":"v2.WorkspaceModelProviderKeyResponse"},"v2.CreateWorkspaceModelProviderKeyBody":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Create an Anthropic API key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"apiKey":{"type":"string","minLength":1,"maxLength":8192,"description":"Provider API key secret. Stored encrypted and never returned by this API."},"active":{"type":"boolean","default":false,"description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."}},"required":["provider","name","apiKey"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"Create an OpenAI API key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"apiKey":{"type":"string","minLength":1,"maxLength":8192,"description":"Provider API key secret. Stored encrypted and never returned by this API."},"active":{"type":"boolean","default":false,"description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig","description":"OpenAI-specific configuration. Defaults to the global region."}},"required":["provider","name","apiKey"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"Create an xAI API key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"apiKey":{"type":"string","minLength":1,"maxLength":8192,"description":"Provider API key secret. Stored encrypted and never returned by this API."},"active":{"type":"boolean","default":false,"description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."}},"required":["provider","name","apiKey"]}],"title":"v2.CreateWorkspaceModelProviderKeyBody"},"v2.UpdateWorkspaceModelProviderKeyBody":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig","description":"Provider-specific configuration. Only supported for openai keys."}},"title":"v2.UpdateWorkspaceModelProviderKeyBody"},"v2.UsageMetrics":{"type":"object","properties":{"linesAdded":{"type":"number","description":"Lines added by the user"},"linesDeleted":{"type":"number","description":"Lines deleted by the user"},"linesModified":{"type":"number","description":"Lines modified by the user"},"usage":{"type":"number","description":"Workspace-attributed usage for the user on that day (USD)"}},"required":["linesAdded","linesDeleted","linesModified","usage"],"title":"v2.UsageMetrics"},"v2.DailyUsageModelRequests":{"type":"object","additionalProperties":{"type":"object","properties":{"requests":{"type":"number","description":"Number of requests for the model"},"inputTokens":{"type":"number","description":"Total uncached input tokens consumed by the model for this user/day"},"outputTokens":{"type":"number","description":"Total output tokens consumed by the model for this user/day"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens consumed by the model for this user/day"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens consumed by the model for this user/day"},"totalTokens":{"type":"number","description":"Total tokens consumed by the model for this user/day"},"usage":{"type":"number","description":"Usage for this model (USD)"}},"required":["requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","totalTokens","usage"],"description":"Request and token metrics for a model"},"description":"Map of provider/model identifiers to request and token metrics for the user","title":"v2.DailyUsageModelRequests"},"v2.DailyUsageUserObject":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"User email - only returned if the client has the \"amp.api:workspace.members:view\" scope"}},"required":["id"],"title":"v2.DailyUsageUserObject"},"v2.DailyUsageUserEntry":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"User email - only returned if the client has the \"amp.api:workspace.members:view\" scope"}},"required":["id"],"title":"v2.DailyUsageUserObject","description":"User information"},"metrics":{"type":"object","properties":{"linesAdded":{"type":"number","description":"Lines added by the user"},"linesDeleted":{"type":"number","description":"Lines deleted by the user"},"linesModified":{"type":"number","description":"Lines modified by the user"},"usage":{"type":"number","description":"Workspace-attributed usage for the user on that day (USD)"}},"required":["linesAdded","linesDeleted","linesModified","usage"],"title":"v2.UsageMetrics","description":"Usage metrics for the user"},"models":{"type":"object","additionalProperties":{"type":"object","properties":{"requests":{"type":"number","description":"Number of requests for the model"},"inputTokens":{"type":"number","description":"Total uncached input tokens consumed by the model for this user/day"},"outputTokens":{"type":"number","description":"Total output tokens consumed by the model for this user/day"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens consumed by the model for this user/day"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens consumed by the model for this user/day"},"totalTokens":{"type":"number","description":"Total tokens consumed by the model for this user/day"},"usage":{"type":"number","description":"Usage for this model (USD)"}},"required":["requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","totalTokens","usage"],"description":"Request and token metrics for a model"},"description":"Per-model request and token counts for the user","title":"v2.DailyUsageModelRequests"}},"required":["user","metrics","models"],"title":"v2.DailyUsageUserEntry"},"v2.DailyUsageDay":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Date in YYYY-MM-DD format"},"users":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"User email - only returned if the client has the \"amp.api:workspace.members:view\" scope"}},"required":["id"],"title":"v2.DailyUsageUserObject","description":"User information"},"metrics":{"type":"object","properties":{"linesAdded":{"type":"number","description":"Lines added by the user"},"linesDeleted":{"type":"number","description":"Lines deleted by the user"},"linesModified":{"type":"number","description":"Lines modified by the user"},"usage":{"type":"number","description":"Workspace-attributed usage for the user on that day (USD)"}},"required":["linesAdded","linesDeleted","linesModified","usage"],"title":"v2.UsageMetrics","description":"Usage metrics for the user"},"models":{"type":"object","additionalProperties":{"type":"object","properties":{"requests":{"type":"number","description":"Number of requests for the model"},"inputTokens":{"type":"number","description":"Total uncached input tokens consumed by the model for this user/day"},"outputTokens":{"type":"number","description":"Total output tokens consumed by the model for this user/day"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens consumed by the model for this user/day"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens consumed by the model for this user/day"},"totalTokens":{"type":"number","description":"Total tokens consumed by the model for this user/day"},"usage":{"type":"number","description":"Usage for this model (USD)"}},"required":["requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","totalTokens","usage"],"description":"Request and token metrics for a model"},"description":"Per-model request and token counts for the user","title":"v2.DailyUsageModelRequests"}},"required":["user","metrics","models"],"title":"v2.DailyUsageUserEntry"},"description":"Usage data for users in scope for the period, including users no longer in the workspace if they have usage attributed to this workspace"}},"required":["date","users"],"title":"v2.DailyUsageDay"},"v2.DailyUsageMetadata":{"type":"object","properties":{"startDate":{"type":"string","format":"date","description":"Start date of the period"},"endDate":{"type":"string","format":"date","description":"End date of the period"},"activeUsers":{"type":"number","description":"Users with non-zero usage in the period"},"totalUsers":{"type":"number","description":"Total distinct users represented in the period, including former members with workspace-attributed usage"},"totalUsage":{"type":"number","description":"Total usage in the period (USD)"}},"required":["startDate","endDate","activeUsers","totalUsers","totalUsage"],"title":"v2.DailyUsageMetadata"},"v2.DailyUsageResponse":{"type":"object","properties":{"metadata":{"type":"object","properties":{"startDate":{"type":"string","format":"date","description":"Start date of the period"},"endDate":{"type":"string","format":"date","description":"End date of the period"},"activeUsers":{"type":"number","description":"Users with non-zero usage in the period"},"totalUsers":{"type":"number","description":"Total distinct users represented in the period, including former members with workspace-attributed usage"},"totalUsage":{"type":"number","description":"Total usage in the period (USD)"}},"required":["startDate","endDate","activeUsers","totalUsers","totalUsage"],"title":"v2.DailyUsageMetadata","description":"Metadata about the usage period"},"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Date in YYYY-MM-DD format"},"users":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"User email - only returned if the client has the \"amp.api:workspace.members:view\" scope"}},"required":["id"],"title":"v2.DailyUsageUserObject","description":"User information"},"metrics":{"type":"object","properties":{"linesAdded":{"type":"number","description":"Lines added by the user"},"linesDeleted":{"type":"number","description":"Lines deleted by the user"},"linesModified":{"type":"number","description":"Lines modified by the user"},"usage":{"type":"number","description":"Workspace-attributed usage for the user on that day (USD)"}},"required":["linesAdded","linesDeleted","linesModified","usage"],"title":"v2.UsageMetrics","description":"Usage metrics for the user"},"models":{"type":"object","additionalProperties":{"type":"object","properties":{"requests":{"type":"number","description":"Number of requests for the model"},"inputTokens":{"type":"number","description":"Total uncached input tokens consumed by the model for this user/day"},"outputTokens":{"type":"number","description":"Total output tokens consumed by the model for this user/day"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens consumed by the model for this user/day"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens consumed by the model for this user/day"},"totalTokens":{"type":"number","description":"Total tokens consumed by the model for this user/day"},"usage":{"type":"number","description":"Usage for this model (USD)"}},"required":["requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","totalTokens","usage"],"description":"Request and token metrics for a model"},"description":"Per-model request and token counts for the user","title":"v2.DailyUsageModelRequests"}},"required":["user","metrics","models"],"title":"v2.DailyUsageUserEntry"},"description":"Usage data for users in scope for the period, including users no longer in the workspace if they have usage attributed to this workspace"}},"required":["date","users"],"title":"v2.DailyUsageDay"},"description":"Daily usage data for each day in the period"}},"required":["metadata","data"],"title":"v2.DailyUsageResponse","description":"Daily usage metrics for the workspace"}},"parameters":{}},"paths":{"/api/v2/threads":{"get":{"description":"List all threads from your workspace, including private and group-shared threads, with optional filtering and pagination. Threads are listed by time of first sync in ascending order for sorting stability.","operationId":"v2_threads_list","tags":["Threads"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.threads.meta:view"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Maximum number of results to return."},"required":false,"description":"Maximum number of results to return.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor for pagination to get the next set of results."},"required":false,"description":"Cursor for pagination to get the next set of results.","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Search query to filter threads by content."},"required":false,"description":"Search query to filter threads by content.","name":"query","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Only include threads where the thread's initial sync time is after this date (ISO 8601 format)."},"required":false,"description":"Only include threads where the thread's initial sync time is after this date (ISO 8601 format).","name":"after","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Only include threads where the thread's initial sync time is before this date (ISO 8601 format)."},"required":false,"description":"Only include threads where the thread's initial sync time is before this date (ISO 8601 format).","name":"before","in":"query"},{"schema":{"type":"string","enum":["ASC","DESC"],"description":"Sort order for results. ASC = oldest first (default), DESC = newest first."},"required":false,"description":"Sort order for results. ASC = oldest first (default), DESC = newest first.","name":"sort","in":"query"},{"schema":{"type":"string","format":"email","description":"Only include threads created by the user with this email address. The user must be in the workspace."},"required":false,"description":"Only include threads created by the user with this email address. The user must be in the workspace.","name":"userEmail","in":"query"},{"schema":{"type":"string","description":"Only include threads created by the user with this user ID. The user must be in the workspace."},"required":false,"description":"Only include threads created by the user with this user ID. The user must be in the workspace.","name":"userID","in":"query"}],"responses":{"200":{"description":"The request has succeeded.","content":{"application/json":{"schema":{"type":"object","properties":{"nextCursor":{"type":"string","description":"Pagination cursor for getting the next set of results."},"threads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the thread."},"title":{"type":"string","description":"Title of the thread. Only returned if the client has the 'amp.api:workspace.threads.contents:view' scope."},"createdAt":{"type":"string","format":"date-time","description":"When the thread was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the thread was last updated."},"firstSyncedAt":{"type":"string","format":"date-time","description":"When the thread was first synced."},"creatorUserID":{"type":"string","description":"User ID of the thread creator."},"mainThreadID":{"type":"string","description":"ID of the main thread, if this is a sub-thread"},"repositories":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","description":"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":{"type":"string","description":"The subdirectory within the repository in which the thread started working. Omitted if it is the root directory of the repository."}},"required":["url"],"title":"v2.Repository"},"description":"Repositories in which this thread started working. Only returned if the client has the 'amp.api:workspace.threads.contents:view' scope."},"subThreads":{"type":"array","description":"Sub-threads belonging to this thread.","items":{"$ref":"#/components/schemas/v2.Thread"}}},"required":["id","creatorUserID"],"title":"v2.Thread","description":"A conversation thread in Amp"},"description":"Array of threads matching the query"}},"required":["threads"],"title":"v2.ThreadListResponse","description":"Response model for thread list operations"}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/threads/{threadID}":{"delete":{"description":"Delete a thread by ID.","operationId":"v2_threads_delete","tags":["Threads"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.threads:manage"]}],"parameters":[{"schema":{"type":"string","description":"ID of the target thread, with the format \"T-...\"."},"required":true,"description":"ID of the target thread, with the format \"T-...\".","name":"threadID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"responses":{"204":{"description":"Thread successfully deleted"},"400":{"description":"Invalid thread ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized - authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/threads/{threadID}/messages":{"get":{"description":"Get the messages belonging to a thread.","operationId":"v2_threads_messages_list","tags":["Threads"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.threads.contents:view"]}],"parameters":[{"schema":{"type":"string","description":"ID of the target thread, with the format \"T-...\"."},"required":true,"description":"ID of the target thread, with the format \"T-...\".","name":"threadID","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Maximum number of results to return."},"required":false,"description":"Maximum number of results to return.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor for pagination to get the next set of results."},"required":false,"description":"Cursor for pagination to get the next set of results.","name":"cursor","in":"query"}],"responses":{"200":{"description":"The request has succeeded.","content":{"application/json":{"schema":{"type":"object","properties":{"nextCursor":{"type":"string","description":"Pagination cursor for getting the next set of results."},"messages":{"type":"array","items":{},"description":"Array of message objects in the thread. Message shapes are currently not stable and may change at any time. For scanning purposes, we recommend checking the entire content of each message."}},"required":["messages"],"title":"v2.ThreadMessagesResponse","description":"Response model for thread messages operations."}}}},"400":{"description":"Invalid thread ID or query parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Thread not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/threads/{threadID}/usage":{"get":{"description":"Get usage information for a thread. Thread usage data is only available for threads less than 90 days old.","operationId":"v2_threads_usage_get","tags":["Threads"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.threads.meta:view"]}],"parameters":[{"schema":{"type":"string","description":"ID of the target thread, with the format \"T-...\"."},"required":true,"description":"ID of the target thread, with the format \"T-...\".","name":"threadID","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"threadID":{"type":"string","description":"The thread ID"},"subThreadIDs":{"type":"array","items":{"type":"string"},"description":"IDs of sub-threads included in the usage calculation"},"usage":{"type":"number","description":"Total thread cost in USD"},"models":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","description":"Provider identifier for the model usage bucket"},"model":{"type":"string","description":"Model identifier for the model usage bucket"},"requests":{"type":"number","description":"Number of requests for this provider/model"},"inputTokens":{"type":"number","description":"Total uncached input tokens for this provider/model"},"outputTokens":{"type":"number","description":"Total output tokens for this provider/model"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens for this provider/model"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens for this provider/model"},"usage":{"type":"number","description":"Total cost in USD for this provider/model"}},"required":["provider","model","requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","usage"]},"description":"Per-model usage and cost breakdown for the thread"}},"required":["threadID","subThreadIDs","usage","models"],"title":"v2.ThreadCostResponse","description":"Thread usage information"}}}},"400":{"description":"Invalid thread ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Thread not found or usage data not available","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/members":{"get":{"description":"List all members in the workspace.","operationId":"v2_workspace_members_list","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.members:view"]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the user"},"name":{"type":"string","description":"Full name of the user"},"email":{"type":"string","format":"email","description":"The primary email address of the user"},"role":{"type":"string","enum":["admin","member"],"description":"Workspace-level role of the user"}},"required":["id","name","email","role"],"title":"v2.WorkspaceMember"},"description":"All members of the workspace"}},"required":["members"],"title":"v2.WorkspaceMembersResponse","description":"Response for workspace members listing"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/groups":{"get":{"description":"List all workspace groups and their members.","operationId":"v2_workspace_groups_list","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:view"]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup"},"description":"All groups in the workspace."}},"required":["groups"],"title":"v2.WorkspaceGroupsResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"post":{"description":"Create a workspace group. Initial members are removed from any other workspace group.","operationId":"v2_workspace_groups_create","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:manage"]}],"parameters":[{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"maxItems":5000,"default":[],"description":"Initial group members. Listed users are removed from any other workspace group."}},"required":["name"],"title":"v2.CreateWorkspaceGroupBody"}}}},"responses":{"201":{"description":"Workspace group created","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup","description":"Workspace group."}},"required":["group"],"title":"v2.WorkspaceGroupResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"409":{"description":"Workspace group name already exists","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/groups/{groupID}":{"get":{"description":"Get one workspace group and its members.","operationId":"v2_workspace_groups_get","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:view"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace group."},"required":true,"description":"ID of the target workspace group.","name":"groupID","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup","description":"Workspace group."}},"required":["group"],"title":"v2.WorkspaceGroupResponse"}}}},"400":{"description":"Invalid group ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"patch":{"description":"Update workspace group metadata.","operationId":"v2_workspace_groups_update","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace group."},"required":true,"description":"ID of the target workspace group.","name":"groupID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."}},"required":["name"],"title":"v2.UpdateWorkspaceGroupBody"}}}},"responses":{"200":{"description":"Workspace group updated","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup","description":"Workspace group."}},"required":["group"],"title":"v2.WorkspaceGroupResponse"}}}},"400":{"description":"Invalid request body or group ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"409":{"description":"Workspace group name already exists","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"delete":{"description":"Delete a workspace group. This removes group memberships and may affect group-based entitlements and group-shared private threads.","operationId":"v2_workspace_groups_delete","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace group."},"required":true,"description":"ID of the target workspace group.","name":"groupID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"responses":{"204":{"description":"Workspace group deleted"},"400":{"description":"Invalid group ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/groups/{groupID}/members":{"put":{"description":"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.","operationId":"v2_workspace_groups_members_replace","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace group."},"required":true,"description":"ID of the target workspace group.","name":"groupID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"maxItems":5000,"description":"Full replacement membership list. After the request succeeds, this group has exactly these members, and listed users are removed from any other workspace group."}},"required":["members"],"title":"v2.ReplaceWorkspaceGroupMembersBody"}}}},"responses":{"200":{"description":"Workspace group members replaced","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup","description":"Workspace group."}},"required":["group"],"title":"v2.WorkspaceGroupResponse"}}}},"400":{"description":"Invalid request body or group ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"post":{"description":"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.","operationId":"v2_workspace_groups_members_add","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.groups:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace group."},"required":true,"description":"ID of the target workspace group.","name":"groupID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMemberEntry"},"maxItems":5000,"description":"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."}},"required":["members"],"title":"v2.AddWorkspaceGroupMembersBody"}}}},"responses":{"200":{"description":"Workspace group members added, moved, or updated","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace group."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace group name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"members":{"type":"array","items":{"type":"object","properties":{"userID":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"role":{"type":"string","enum":["captain","member"],"description":"Role of the user in the workspace group. Captains can manage their group."},"name":{"type":"string","description":"Full name of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."},"email":{"type":"string","format":"email","description":"Primary email address of the user. Only returned if the client has the \"amp.api:workspace.members:view\" scope."}},"required":["userID","role"],"title":"v2.WorkspaceGroupMember"},"description":"Members assigned to the workspace group."}},"required":["id","name","members"],"title":"v2.WorkspaceGroup","description":"Workspace group."}},"required":["group"],"title":"v2.WorkspaceGroupResponse"}}}},"400":{"description":"Invalid request body or group ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/entitlements":{"get":{"description":"List all workspace entitlements.","operationId":"v2_workspace_entitlements_list","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.entitlements:view"]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"entitlements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement"},"description":"All workspace entitlements."}},"required":["entitlements"],"title":"v2.WorkspaceEntitlementsResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"post":{"description":"Create a workspace entitlement for dollar-denominated credit caps. Assignments can target default workspace members, direct users, or workspace groups.","operationId":"v2_workspace_entitlements_create","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.entitlements:manage"]}],"parameters":[{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]}],"description":"Who receives this entitlement."}},"required":["name","usageLimitUSD","windowDays","assignment"],"title":"v2.CreateWorkspaceEntitlementBody"}}}},"responses":{"201":{"description":"Workspace entitlement created","content":{"application/json":{"schema":{"type":"object","properties":{"entitlement":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement","description":"Workspace entitlement."}},"required":["entitlement"],"title":"v2.WorkspaceEntitlementResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"409":{"description":"Workspace entitlement conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/entitlements/{entitlementID}":{"get":{"description":"Get one workspace entitlement.","operationId":"v2_workspace_entitlements_get","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.entitlements:view"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace entitlement."},"required":true,"description":"ID of the target workspace entitlement.","name":"entitlementID","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"entitlement":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement","description":"Workspace entitlement."}},"required":["entitlement"],"title":"v2.WorkspaceEntitlementResponse"}}}},"400":{"description":"Invalid entitlement ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace entitlement not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"patch":{"description":"Update provided workspace entitlement fields. If assignment is provided, it replaces the entitlement assignment.","operationId":"v2_workspace_entitlements_update","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.entitlements:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace entitlement."},"required":true,"description":"ID of the target workspace entitlement.","name":"entitlementID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]}],"description":"Who receives this entitlement. If provided, this replaces the entitlement assignment; userIDs and workspaceGroupIDs are full replacement lists, not incremental additions."}},"title":"v2.UpdateWorkspaceEntitlementBody"}}}},"responses":{"200":{"description":"Workspace entitlement updated","content":{"application/json":{"schema":{"type":"object","properties":{"entitlement":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace entitlement."},"name":{"type":"string","minLength":3,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]{2,}$","description":"Workspace entitlement name. Must be 3-32 lowercase letters, numbers, or hyphens, and start with a letter or number."},"type":{"type":"string","enum":["paid_credits"],"description":"Resource type limited by this entitlement."},"usageLimitUSD":{"type":"integer","minimum":0,"maximum":1000000,"description":"Dollar-denominated credit cap in whole US dollars."},"windowDays":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[7]},{"type":"number","enum":[30]}],"description":"Fixed quota window in days. Supported values are 1, 7, and 30."},"assignment":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["default"],"description":"Apply this entitlement to workspace members without a more specific entitlement."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["users"]},"userIDs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256,"description":"Workspace member user ID."},"maxItems":5000,"description":"Workspace member user IDs assigned directly to this entitlement. Direct user assignments take precedence over group and default assignments."}},"required":["type","userIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["workspace_groups"]},"workspaceGroupIDs":{"type":"array","items":{"type":"string","format":"uuid","description":"Workspace group ID."},"minItems":1,"maxItems":1000,"description":"Workspace group IDs assigned to this entitlement. Direct user assignments take precedence over group assignments."}},"required":["type","workspaceGroupIDs"]},{"type":"object","properties":{"type":{"type":"string","enum":["unmanaged"],"description":"This entitlement uses an assignment mechanism not managed by this API."}},"required":["type"]}],"description":"Who receives this entitlement."}},"required":["id","name","type","usageLimitUSD","windowDays","assignment"],"title":"v2.WorkspaceEntitlement","description":"Workspace entitlement."}},"required":["entitlement"],"title":"v2.WorkspaceEntitlementResponse"}}}},"400":{"description":"Invalid request body or entitlement ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace entitlement not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"409":{"description":"Workspace entitlement conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"delete":{"description":"Delete a workspace entitlement.","operationId":"v2_workspace_entitlements_delete","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.entitlements:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace entitlement."},"required":true,"description":"ID of the target workspace entitlement.","name":"entitlementID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"responses":{"204":{"description":"Workspace entitlement deleted"},"400":{"description":"Invalid entitlement ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace entitlement not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/model-provider-keys":{"get":{"description":"List all workspace model provider (BYOK) keys. Key secrets are never returned.","operationId":"v2_workspace_model_provider_keys_list","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.model-provider-keys:view"]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"modelProviderKeys":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"A workspace model provider (BYOK) key. Inference for a provider uses the workspace key that is currently active for that provider."},"description":"All workspace model provider keys."}},"required":["modelProviderKeys"],"title":"v2.WorkspaceModelProviderKeysResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"post":{"description":"Create a workspace model provider (BYOK) key. Keys are created inactive unless active is true; activating a key deactivates any other active key for the same provider. To rotate a key, create a new key with the new secret and active set to true, then delete the old key.","operationId":"v2_workspace_model_provider_keys_create","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.model-provider-keys:manage"]}],"parameters":[{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Create an Anthropic API key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"apiKey":{"type":"string","minLength":1,"maxLength":8192,"description":"Provider API key secret. Stored encrypted and never returned by this API."},"active":{"type":"boolean","default":false,"description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."}},"required":["provider","name","apiKey"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"Create an OpenAI API key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"apiKey":{"type":"string","minLength":1,"maxLength":8192,"description":"Provider API key secret. Stored encrypted and never returned by this API."},"active":{"type":"boolean","default":false,"description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig","description":"OpenAI-specific configuration. Defaults to the global region."}},"required":["provider","name","apiKey"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"Create an xAI API key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"apiKey":{"type":"string","minLength":1,"maxLength":8192,"description":"Provider API key secret. Stored encrypted and never returned by this API."},"active":{"type":"boolean","default":false,"description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."}},"required":["provider","name","apiKey"]}],"title":"v2.CreateWorkspaceModelProviderKeyBody"}}}},"responses":{"201":{"description":"Workspace model provider key created","content":{"application/json":{"schema":{"type":"object","properties":{"modelProviderKey":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"Workspace model provider key."}},"required":["modelProviderKey"],"title":"v2.WorkspaceModelProviderKeyResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s) or restricted configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"409":{"description":"Workspace model provider key conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/model-provider-keys/{keyID}":{"get":{"description":"Get one workspace model provider (BYOK) key. Key secrets are never returned.","operationId":"v2_workspace_model_provider_keys_get","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.model-provider-keys:view"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace model provider key."},"required":true,"description":"ID of the target workspace model provider key.","name":"keyID","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"modelProviderKey":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"Workspace model provider key."}},"required":["modelProviderKey"],"title":"v2.WorkspaceModelProviderKeyResponse"}}}},"400":{"description":"Invalid key ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace model provider key not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"patch":{"description":"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.","operationId":"v2_workspace_model_provider_keys_update","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.model-provider-keys:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace model provider key."},"required":true,"description":"ID of the target workspace model provider key.","name":"keyID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig","description":"Provider-specific configuration. Only supported for openai keys."}},"title":"v2.UpdateWorkspaceModelProviderKeyBody"}}}},"responses":{"200":{"description":"Workspace model provider key updated","content":{"application/json":{"schema":{"type":"object","properties":{"modelProviderKey":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic"],"description":"Anthropic API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]},{"type":"object","properties":{"provider":{"type":"string","enum":["openai"],"description":"OpenAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."},"config":{"type":"object","properties":{"openAIRegion":{"type":"string","enum":["global","us","eu","au","ca","jp","in","sg","kr","gb","ae"],"default":"global","description":"OpenAI data-residency region for this key. Non-global regions are only available for Enterprise workspaces."}},"title":"v2.WorkspaceModelProviderKeyOpenAIConfig"}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt","config"]},{"type":"object","properties":{"provider":{"type":"string","enum":["xai"],"description":"xAI API key."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the workspace model provider key."},"name":{"type":"string","minLength":1,"maxLength":256,"description":"Display name for the model provider key. Must be unique per provider within the workspace."},"redactedKey":{"type":["string","null"],"description":"Redacted display form of the stored API key, such as \"sk-ant-api••••1234\"."},"active":{"type":"boolean","description":"Whether this key is used for inference for its provider. At most one key per provider can be active at a time; activating a key deactivates any other active key for the same provider."},"lastUsedAt":{"type":["string","null"],"format":"date-time","description":"When the key was last used for inference, with roughly 30-second granularity."},"createdAt":{"type":"string","format":"date-time","description":"When the key was created."},"updatedAt":{"type":"string","format":"date-time","description":"When the key was last updated."}},"required":["provider","id","name","redactedKey","active","lastUsedAt","createdAt","updatedAt"]}],"description":"Workspace model provider key."}},"required":["modelProviderKey"],"title":"v2.WorkspaceModelProviderKeyResponse"}}}},"400":{"description":"Invalid request body or key ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s) or restricted configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace model provider key not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"409":{"description":"Workspace model provider key conflict","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}},"delete":{"description":"Delete a workspace model provider (BYOK) key. The stored key secret is destroyed immediately.","operationId":"v2_workspace_model_provider_keys_delete","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.model-provider-keys:manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"ID of the target workspace model provider key."},"required":true,"description":"ID of the target workspace model provider key.","name":"keyID","in":"path"},{"schema":{"type":"string","description":"Must be application/json","example":"application/json"},"required":true,"description":"Must be application/json","name":"Content-Type","in":"header"}],"responses":{"204":{"description":"Workspace model provider key deleted"},"400":{"description":"Invalid key ID parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"404":{"description":"Workspace model provider key not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}},"/api/v2/workspace/analytics/daily-usage":{"get":{"description":"Get daily usage analytics for your workspace. Returns usage metrics and costs for users in the specified time period.","operationId":"v2_workspace_analytics_daily_usage","tags":["Workspace"],"security":[{"v2.OAuth2AppAuth":["amp.api:workspace.analytics:view"]}],"parameters":[{"schema":{"type":"string","format":"date","description":"End date (YYYY-MM-DD). Default: today"},"required":false,"description":"End date (YYYY-MM-DD). Default: today","name":"endDate","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":365,"default":1,"description":"Number of days to include."},"required":false,"description":"Number of days to include.","name":"lookbackDays","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":256,"description":"Only include workspace-attributed usage for this user ID."},"required":false,"description":"Only include workspace-attributed usage for this user ID.","name":"userID","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"metadata":{"type":"object","properties":{"startDate":{"type":"string","format":"date","description":"Start date of the period"},"endDate":{"type":"string","format":"date","description":"End date of the period"},"activeUsers":{"type":"number","description":"Users with non-zero usage in the period"},"totalUsers":{"type":"number","description":"Total distinct users represented in the period, including former members with workspace-attributed usage"},"totalUsage":{"type":"number","description":"Total usage in the period (USD)"}},"required":["startDate","endDate","activeUsers","totalUsers","totalUsage"],"title":"v2.DailyUsageMetadata","description":"Metadata about the usage period"},"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Date in YYYY-MM-DD format"},"users":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"User email - only returned if the client has the \"amp.api:workspace.members:view\" scope"}},"required":["id"],"title":"v2.DailyUsageUserObject","description":"User information"},"metrics":{"type":"object","properties":{"linesAdded":{"type":"number","description":"Lines added by the user"},"linesDeleted":{"type":"number","description":"Lines deleted by the user"},"linesModified":{"type":"number","description":"Lines modified by the user"},"usage":{"type":"number","description":"Workspace-attributed usage for the user on that day (USD)"}},"required":["linesAdded","linesDeleted","linesModified","usage"],"title":"v2.UsageMetrics","description":"Usage metrics for the user"},"models":{"type":"object","additionalProperties":{"type":"object","properties":{"requests":{"type":"number","description":"Number of requests for the model"},"inputTokens":{"type":"number","description":"Total uncached input tokens consumed by the model for this user/day"},"outputTokens":{"type":"number","description":"Total output tokens consumed by the model for this user/day"},"cacheReadInputTokens":{"type":"number","description":"Total cache-read input tokens consumed by the model for this user/day"},"cacheCreationInputTokens":{"type":"number","description":"Total cache-creation input tokens consumed by the model for this user/day"},"totalTokens":{"type":"number","description":"Total tokens consumed by the model for this user/day"},"usage":{"type":"number","description":"Usage for this model (USD)"}},"required":["requests","inputTokens","outputTokens","cacheReadInputTokens","cacheCreationInputTokens","totalTokens","usage"],"description":"Request and token metrics for a model"},"description":"Per-model request and token counts for the user","title":"v2.DailyUsageModelRequests"}},"required":["user","metrics","models"],"title":"v2.DailyUsageUserEntry"},"description":"Usage data for users in scope for the period, including users no longer in the workspace if they have usage attributed to this workspace"}},"required":["date","users"],"title":"v2.DailyUsageDay"},"description":"Daily usage data for each day in the period"}},"required":["metadata","data"],"title":"v2.DailyUsageResponse","description":"Daily usage metrics for the workspace"}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"403":{"description":"Forbidden: missing client scope(s)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing what went wrong"}},"required":["error"],"title":"v2.ErrorResponse","description":"Standard error response format"}}}}}}}},"webhooks":{}}