diff --git a/content/docs/api-v2/reference/sub-accounts/createSubAccount.mdx b/content/docs/api-v2/reference/sub-accounts/createSubAccount.mdx new file mode 100644 index 0000000..55f0656 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/createSubAccount.mdx @@ -0,0 +1,60 @@ +--- +title: Create a sub-account +full: true +_openapi: + method: POST + toc: [] + structuredData: + headings: [] + contents: + - content: >- + Creates a sub-account under your master account and returns its API + key. The key is shown once: store it server-side, keyed to your + customer. + - content: >- + external_id: Your own identifier for this customer, returned as-is on + reads + - content: name + - content: data + - content: 'data.api_key: Shown once; store it now, it cannot be retrieved later' + - content: data.external_id + - content: data.name + - content: data.sub_account_id + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +Creates a sub-account under your master account and returns its API key. The key is shown once: store it server-side, keyed to your customer. + + diff --git a/content/docs/api-v2/reference/sub-accounts/deleteSubAccount.mdx b/content/docs/api-v2/reference/sub-accounts/deleteSubAccount.mdx new file mode 100644 index 0000000..1cc22ca --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/deleteSubAccount.mdx @@ -0,0 +1,53 @@ +--- +title: Delete a sub-account +full: true +_openapi: + method: DELETE + toc: [] + structuredData: + headings: [] + contents: + - content: >- + Soft-deletes the sub-account and disables its API keys. Recorded data + follows the normal retention policy. + - content: data + - content: data.deleted + - content: data.sub_account_id + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +Soft-deletes the sub-account and disables its API keys. Recorded data follows the normal retention policy. + + diff --git a/content/docs/api-v2/reference/sub-accounts/deleteSubAccountWebhook.mdx b/content/docs/api-v2/reference/sub-accounts/deleteSubAccountWebhook.mdx new file mode 100644 index 0000000..865bdb1 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/deleteSubAccountWebhook.mdx @@ -0,0 +1,54 @@ +--- +title: Remove a sub-account's webhook endpoint +full: true +_openapi: + method: DELETE + toc: [] + structuredData: + headings: [] + contents: + - content: data + - content: data.deleted + - content: data.sub_account_id + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + + diff --git a/content/docs/api-v2/reference/sub-accounts/getSubAccount.mdx b/content/docs/api-v2/reference/sub-accounts/getSubAccount.mdx new file mode 100644 index 0000000..70395c6 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/getSubAccount.mdx @@ -0,0 +1,53 @@ +--- +title: Get a sub-account +full: true +_openapi: + method: GET + toc: [] + structuredData: + headings: [] + contents: + - content: data + - content: data.calendar_integrations_limit + - content: data.created_at + - content: data.daily_bot_cap + - content: data.external_id + - content: data.name + - content: data.status + - content: data.sub_account_id + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + + diff --git a/content/docs/api-v2/reference/sub-accounts/getSubAccountUsage.mdx b/content/docs/api-v2/reference/sub-accounts/getSubAccountUsage.mdx new file mode 100644 index 0000000..680d2b5 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/getSubAccountUsage.mdx @@ -0,0 +1,63 @@ +--- +title: Get a sub-account's usage over a period +full: true +_openapi: + method: GET + toc: [] + structuredData: + headings: [] + contents: + - content: >- + Aggregated consumption of the sub-account between start_date + (inclusive) and end_date (exclusive) — the data you invoice your + customer from. Still resolves after you delete the sub-account, so a + closed customer's final period is billable. + - content: data + - content: data.bot_count + - content: data.byok_transcription_tokens + - content: data.duration_seconds + - content: data.end_date + - content: data.recording_tokens + - content: data.refunded_tokens + - content: data.start_date + - content: data.sub_account_id + - content: data.total_tokens + - content: data.transcription_tokens + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +Aggregated consumption of the sub-account between start_date (inclusive) and end_date (exclusive) — the data you invoice your customer from. Still resolves after you delete the sub-account, so a closed customer's final period is billable. + + diff --git a/content/docs/api-v2/reference/sub-accounts/getSubAccountWebhook.mdx b/content/docs/api-v2/reference/sub-accounts/getSubAccountWebhook.mdx new file mode 100644 index 0000000..526ecaf --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/getSubAccountWebhook.mdx @@ -0,0 +1,55 @@ +--- +title: Get a sub-account's webhook endpoint +full: true +_openapi: + method: GET + toc: [] + structuredData: + headings: [] + contents: + - content: data + - content: data.created_at + - content: data.sub_account_id + - content: data.url + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + + diff --git a/content/docs/api-v2/reference/sub-accounts/getSubAccountsUsage.mdx b/content/docs/api-v2/reference/sub-accounts/getSubAccountsUsage.mdx new file mode 100644 index 0000000..bbd895a --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/getSubAccountsUsage.mdx @@ -0,0 +1,52 @@ +--- +title: Get usage for every sub-account over a period +full: true +_openapi: + method: GET + toc: [] + structuredData: + headings: [] + contents: + - content: >- + One row per sub-account, including ones you have deleted — a customer + closed mid-period still has to be invoiced for it. This is the + endpoint to build a billing run on. + - content: data + - content: data.end_date + - content: data.start_date + - content: data.sub_accounts + - content: >- + next_cursor: Pass back as `cursor` to fetch the next page; null when + this is the last page + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +One row per sub-account, including ones you have deleted — a customer closed mid-period still has to be invoiced for it. This is the endpoint to build a billing run on. + + diff --git a/content/docs/api-v2/reference/sub-accounts/listSubAccounts.mdx b/content/docs/api-v2/reference/sub-accounts/listSubAccounts.mdx new file mode 100644 index 0000000..7b736c7 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/listSubAccounts.mdx @@ -0,0 +1,48 @@ +--- +title: List your sub-accounts +full: true +_openapi: + method: GET + toc: [] + structuredData: + headings: [] + contents: + - content: >- + Paginated with an opaque cursor. There is no limit on how many + sub-accounts you may open — the page size only bounds the response. + - content: data + - content: >- + next_cursor: Pass back as `cursor` to fetch the next page; null when + this is the last page + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +Paginated with an opaque cursor. There is no limit on how many sub-accounts you may open — the page size only bounds the response. + + diff --git a/content/docs/api-v2/reference/sub-accounts/rotateSubAccountKey.mdx b/content/docs/api-v2/reference/sub-accounts/rotateSubAccountKey.mdx new file mode 100644 index 0000000..5f32bea --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/rotateSubAccountKey.mdx @@ -0,0 +1,59 @@ +--- +title: Rotate a sub-account's API key +full: true +_openapi: + method: POST + toc: [] + structuredData: + headings: [] + contents: + - content: >- + Mints a new key and permanently revokes all previous keys of the + sub-account. Refused while suspended. + - content: data + - content: 'data.api_key: Shown once; all previous keys are disabled' + - content: data.sub_account_id + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +Mints a new key and permanently revokes all previous keys of the sub-account. Refused while suspended. + + diff --git a/content/docs/api-v2/reference/sub-accounts/setSubAccountWebhook.mdx b/content/docs/api-v2/reference/sub-accounts/setSubAccountWebhook.mdx new file mode 100644 index 0000000..3c8fbe0 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/setSubAccountWebhook.mdx @@ -0,0 +1,65 @@ +--- +title: Set a sub-account's webhook endpoint +full: true +_openapi: + method: PUT + toc: [] + structuredData: + headings: [] + contents: + - content: >- + Where this sub-account's bot events are delivered. One endpoint per + sub-account: setting a new URL replaces the previous one. Your + customers have no dashboard of their own, so this is the only way to + point their events anywhere. + - content: >- + url: HTTPS endpoint that this sub-account's bot events are delivered + to + - content: data + - content: data.created_at + - content: data.sub_account_id + - content: data.url + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + +Where this sub-account's bot events are delivered. One endpoint per sub-account: setting a new URL replaces the previous one. Your customers have no dashboard of their own, so this is the only way to point their events anywhere. + + diff --git a/content/docs/api-v2/reference/sub-accounts/updateSubAccount.mdx b/content/docs/api-v2/reference/sub-accounts/updateSubAccount.mdx new file mode 100644 index 0000000..4a7c486 --- /dev/null +++ b/content/docs/api-v2/reference/sub-accounts/updateSubAccount.mdx @@ -0,0 +1,59 @@ +--- +title: Suspend or reactivate a sub-account +full: true +_openapi: + method: PATCH + toc: [] + structuredData: + headings: [] + contents: + - content: >- + calendar_integrations_limit: Calendar connections allowed for this + sub-account; capped at your master account's own limit + - content: >- + daily_bot_cap: Per-day bot limit for this sub-account; capped at your + master account's own limit + - content: >- + status: suspended blocks all bot dispatch and disables every API key + of the sub-account + - content: data + - content: data.calendar_integrations_limit + - content: data.daily_bot_cap + - content: data.status + - content: data.sub_account_id + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'error: Error name' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'retryAfter: Number of seconds to wait before retrying' + - content: 'statusCode: HTTP status code' + - content: success + - content: 'code: Error code for programmatic handling' + - content: 'details: Additional error details (string or null)' + - content: 'error: Human-readable error message' + - content: 'message: Human-readable error message' + - content: 'statusCode: HTTP status code' + - content: success +--- + +{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */} + + diff --git a/openapi-v2.json b/openapi-v2.json index 5efc15d..f339bd5 100644 --- a/openapi-v2.json +++ b/openapi-v2.json @@ -25968,6 +25968,2329 @@ ] } }, + "/v2/sub_accounts": { + "get": { + "description": "Paginated with an opaque cursor. There is no limit on how many sub-accounts you may open — the page size only bounds the response.", + "operationId": "listSubAccounts", + "parameters": [ + { + "description": "Maximum number of sub-accounts to return (default: 100, max: 250).", + "in": "query", + "name": "limit", + "required": true, + "schema": { + "default": 100, + "exclusiveMinimum": 0, + "maximum": 250, + "type": "integer" + } + }, + { + "description": "Cursor from the previous response's `next_cursor`. Leave as `null` for the first page.", + "in": "query", + "name": "cursor", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "items": { + "additionalProperties": false, + "properties": { + "created_at": { + "format": "date-time", + "type": "string" + }, + "external_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "status": { + "enum": [ + "active", + "suspended" + ], + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "name", + "external_id", + "status", + "created_at" + ], + "type": "object" + }, + "type": "array" + }, + "next_cursor": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Pass back as `cursor` to fetch the next page; null when this is the last page" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data", + "next_cursor" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "List your sub-accounts", + "tags": [ + "Sub-accounts" + ] + }, + "post": { + "description": "Creates a sub-account under your master account and returns its API key. The key is shown once: store it server-side, keyed to your customer.", + "operationId": "createSubAccount", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "external_id": { + "description": "Your own identifier for this customer, returned as-is on reads", + "maxLength": 255, + "type": "string" + }, + "name": { + "maxLength": 100, + "minLength": 1, + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "api_key": { + "description": "Shown once; store it now, it cannot be retrieved later", + "type": "string" + }, + "external_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "name", + "external_id", + "api_key" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Conflict - A live sub-account with this external_id already exists under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Create a sub-account", + "tags": [ + "Sub-accounts" + ] + } + }, + "/v2/sub_accounts/usage": { + "get": { + "description": "One row per sub-account, including ones you have deleted — a customer closed mid-period still has to be invoiced for it. This is the endpoint to build a billing run on.", + "operationId": "getSubAccountsUsage", + "parameters": [ + { + "description": "Inclusive ISO date/datetime lower bound", + "in": "query", + "name": "start_date", + "required": true, + "schema": {} + }, + { + "description": "Exclusive ISO date/datetime upper bound", + "in": "query", + "name": "end_date", + "required": true, + "schema": {} + }, + { + "description": "Maximum number of sub-accounts to return (default: 100, max: 250).", + "in": "query", + "name": "limit", + "required": true, + "schema": { + "default": 100, + "exclusiveMinimum": 0, + "maximum": 250, + "type": "integer" + } + }, + { + "description": "Cursor from the previous response's `next_cursor`. Leave as `null` for the first page.", + "in": "query", + "name": "cursor", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "end_date": { + "format": "date-time", + "type": "string" + }, + "start_date": { + "format": "date-time", + "type": "string" + }, + "sub_accounts": { + "items": { + "additionalProperties": false, + "properties": { + "bot_count": { + "maximum": 9007199254740991, + "minimum": -9007199254740991, + "type": "integer" + }, + "byok_transcription_tokens": { + "type": "string" + }, + "duration_seconds": { + "type": "string" + }, + "external_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "recording_tokens": { + "type": "string" + }, + "refunded_tokens": { + "type": "string" + }, + "status": { + "enum": [ + "active", + "suspended", + "deleted" + ], + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + }, + "total_tokens": { + "type": "string" + }, + "transcription_tokens": { + "type": "string" + } + }, + "required": [ + "bot_count", + "total_tokens", + "recording_tokens", + "transcription_tokens", + "byok_transcription_tokens", + "refunded_tokens", + "duration_seconds", + "sub_account_id", + "name", + "external_id", + "status" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "start_date", + "end_date", + "sub_accounts" + ], + "type": "object" + }, + "next_cursor": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Pass back as `cursor` to fetch the next page; null when this is the last page" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "next_cursor", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Get usage for every sub-account over a period", + "tags": [ + "Sub-accounts" + ] + } + }, + "/v2/sub_accounts/{sub_account_id}": { + "delete": { + "description": "Soft-deletes the sub-account and disables its API keys. Recorded data follows the normal retention policy.", + "operationId": "deleteSubAccount", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "deleted": { + "enum": [ + true + ], + "type": "boolean" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "deleted" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Delete a sub-account", + "tags": [ + "Sub-accounts" + ] + }, + "get": { + "operationId": "getSubAccount", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "calendar_integrations_limit": { + "maximum": 9007199254740991, + "minimum": -9007199254740991, + "type": "integer" + }, + "created_at": { + "format": "date-time", + "type": "string" + }, + "daily_bot_cap": { + "maximum": 9007199254740991, + "minimum": -9007199254740991, + "type": "integer" + }, + "external_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "status": { + "enum": [ + "active", + "suspended" + ], + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "name", + "external_id", + "status", + "created_at", + "daily_bot_cap", + "calendar_integrations_limit" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Get a sub-account", + "tags": [ + "Sub-accounts" + ] + }, + "patch": { + "operationId": "updateSubAccount", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "calendar_integrations_limit": { + "description": "Calendar connections allowed for this sub-account; capped at your master account's own limit", + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" + }, + "daily_bot_cap": { + "description": "Per-day bot limit for this sub-account; capped at your master account's own limit", + "maximum": 9007199254740991, + "minimum": 1, + "type": "integer" + }, + "status": { + "description": "suspended blocks all bot dispatch and disables every API key of the sub-account", + "enum": [ + "active", + "suspended" + ], + "type": "string" + } + }, + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "calendar_integrations_limit": { + "maximum": 9007199254740991, + "minimum": -9007199254740991, + "type": "integer" + }, + "daily_bot_cap": { + "maximum": 9007199254740991, + "minimum": -9007199254740991, + "type": "integer" + }, + "status": { + "enum": [ + "active", + "suspended" + ], + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "status", + "daily_bot_cap", + "calendar_integrations_limit" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Suspend or reactivate a sub-account", + "tags": [ + "Sub-accounts" + ] + } + }, + "/v2/sub_accounts/{sub_account_id}/keys/rotate": { + "post": { + "description": "Mints a new key and permanently revokes all previous keys of the sub-account. Refused while suspended.", + "operationId": "rotateSubAccountKey", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "api_key": { + "description": "Shown once; all previous keys are disabled", + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "api_key" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Conflict - The sub-account is suspended; reactivate it before rotating its key" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Rotate a sub-account's API key", + "tags": [ + "Sub-accounts" + ] + } + }, + "/v2/sub_accounts/{sub_account_id}/usage": { + "get": { + "description": "Aggregated consumption of the sub-account between start_date (inclusive) and end_date (exclusive) — the data you invoice your customer from. Still resolves after you delete the sub-account, so a closed customer's final period is billable.", + "operationId": "getSubAccountUsage", + "parameters": [ + { + "description": "Inclusive ISO date/datetime lower bound", + "in": "query", + "name": "start_date", + "required": true, + "schema": {} + }, + { + "description": "Exclusive ISO date/datetime upper bound", + "in": "query", + "name": "end_date", + "required": true, + "schema": {} + }, + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "bot_count": { + "maximum": 9007199254740991, + "minimum": -9007199254740991, + "type": "integer" + }, + "byok_transcription_tokens": { + "type": "string" + }, + "duration_seconds": { + "type": "string" + }, + "end_date": { + "format": "date-time", + "type": "string" + }, + "recording_tokens": { + "type": "string" + }, + "refunded_tokens": { + "type": "string" + }, + "start_date": { + "format": "date-time", + "type": "string" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + }, + "total_tokens": { + "type": "string" + }, + "transcription_tokens": { + "type": "string" + } + }, + "required": [ + "sub_account_id", + "start_date", + "end_date", + "bot_count", + "total_tokens", + "recording_tokens", + "transcription_tokens", + "byok_transcription_tokens", + "refunded_tokens", + "duration_seconds" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + } + }, + "summary": "Get a sub-account's usage over a period", + "tags": [ + "Sub-accounts" + ] + } + }, + "/v2/sub_accounts/{sub_account_id}/webhook": { + "delete": { + "operationId": "deleteSubAccountWebhook", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "deleted": { + "enum": [ + true + ], + "type": "boolean" + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": [ + "sub_account_id", + "deleted" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + }, + "501": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Implemented - Managed webhooks are not enabled on this deployment" + } + }, + "summary": "Remove a sub-account's webhook endpoint", + "tags": [ + "Sub-accounts" + ] + }, + "get": { + "operationId": "getSubAccountWebhook", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "created_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "sub_account_id", + "url", + "created_at" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + }, + "501": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Implemented - Managed webhooks are not enabled on this deployment" + } + }, + "summary": "Get a sub-account's webhook endpoint", + "tags": [ + "Sub-accounts" + ] + }, + "put": { + "description": "Where this sub-account's bot events are delivered. One endpoint per sub-account: setting a new URL replaces the previous one. Your customers have no dashboard of their own, so this is the only way to point their events anywhere.", + "operationId": "setSubAccountWebhook", + "parameters": [ + { + "in": "path", + "name": "sub_account_id", + "required": true, + "schema": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "url": { + "description": "HTTPS endpoint that this sub-account's bot events are delivered to", + "format": "uri", + "type": "string" + } + }, + "required": [ + "url" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "created_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "sub_account_id": { + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "sub_account_id", + "url", + "created_at" + ], + "type": "object" + }, + "success": { + "enum": [ + true + ], + "type": "boolean" + } + }, + "required": [ + "success", + "data" + ], + "type": "object" + } + } + }, + "description": "Default Response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + }, + "description": "Bad Request - Invalid input or validation error" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Forbidden - The team is not reseller-enabled, is itself a sub-account, or the caller lacks the owner/admin role" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Found - No such sub-account under this master account" + }, + "429": { + "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "description": "Rate Limited - Exceeded rate limit", + "properties": { + "code": { + "description": "Error code for programmatic handling", + "type": "string" + }, + "details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Additional error details (string or null)" + }, + "error": { + "description": "Human-readable error message", + "type": "string" + }, + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error message" + }, + "retryAfter": { + "description": "Number of seconds to wait before retrying", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "statusCode": { + "description": "HTTP status code", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" + }, + "success": { + "default": false, + "enum": [ + false + ], + "type": "boolean" + } + }, + "required": [ + "success", + "error", + "code", + "statusCode" + ], + "type": "object" + } + } + }, + "description": "Rate Limited - Exceeded rate limit" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal Server Error - Unexpected server error" + }, + "501": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Not Implemented - Managed webhooks are not enabled on this deployment" + } + }, + "summary": "Set a sub-account's webhook endpoint", + "tags": [ + "Sub-accounts" + ] + } + }, "/v2/teams-login/release-session": { "post": { "responses": {