2
0
Files
bot/apps/docs/openapi/builder/_spec_.json
2023-03-14 16:42:12 +01:00

2765 lines
86 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "Builder API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://app.typebot.io/api/v1"
}
],
"paths": {
"/t/process": {
"post": {
"operationId": "query.processTelemetryEvent",
"description": "Only used for the cloud version of Typebot. It's the way it processes telemetry events and inject it to thrid-party services.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"Workspace created"
]
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
}
},
"required": [
"plan"
],
"additionalProperties": false
}
},
"required": [
"userId",
"workspaceId",
"name",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"User created"
]
},
"data": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"email"
],
"additionalProperties": false
}
},
"required": [
"userId",
"name",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"typebotId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"Typebot created"
]
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"template": {
"type": "string"
}
},
"required": [
"name"
],
"additionalProperties": false
}
},
"required": [
"userId",
"workspaceId",
"typebotId",
"name",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"typebotId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"Typebot published"
]
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"isFirstPublish": {
"type": "boolean",
"enum": [
true
]
}
},
"required": [
"name"
],
"additionalProperties": false
}
},
"required": [
"userId",
"workspaceId",
"typebotId",
"name",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"Subscription updated"
]
},
"data": {
"type": "object",
"properties": {
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
},
"additionalChatsIndex": {
"type": "number"
},
"additionalStorageIndex": {
"type": "number"
}
},
"required": [
"plan",
"additionalChatsIndex",
"additionalStorageIndex"
],
"additionalProperties": false
}
},
"required": [
"userId",
"workspaceId",
"name",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"typebotId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"New results collected"
]
},
"data": {
"type": "object",
"properties": {
"total": {
"type": "number"
}
},
"required": [
"total"
],
"additionalProperties": false
}
},
"required": [
"userId",
"workspaceId",
"typebotId",
"name",
"data"
],
"additionalProperties": false
}
]
}
}
},
"required": [
"events"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"enum": [
"Events injected"
]
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/workspaces": {
"get": {
"operationId": "query.workspace.listWorkspaces",
"summary": "List workspaces",
"tags": [
"Workspace"
],
"security": [
{
"Authorization": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspaces": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
}
},
"required": [
"id",
"name",
"icon",
"plan"
],
"additionalProperties": false
}
}
},
"required": [
"workspaces"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"post": {
"operationId": "mutation.workspace.createWorkspace",
"summary": "Create workspace",
"tags": [
"Workspace"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspace": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"name": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
},
"stripeId": {
"type": "string",
"nullable": true
},
"additionalChatsIndex": {
"type": "number"
},
"additionalStorageIndex": {
"type": "number"
},
"chatsLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"chatsLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"customChatsLimit": {
"type": "number",
"nullable": true
},
"customStorageLimit": {
"type": "number",
"nullable": true
},
"customSeatsLimit": {
"type": "number",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
"additionalChatsIndex",
"additionalStorageIndex",
"chatsLimitFirstEmailSentAt",
"chatsLimitSecondEmailSentAt",
"storageLimitFirstEmailSentAt",
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
],
"additionalProperties": false
}
},
"required": [
"workspace"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/workspaces/{workspaceId}": {
"get": {
"operationId": "query.workspace.getWorkspace",
"summary": "Get workspace",
"tags": [
"Workspace"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspace": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"name": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
},
"stripeId": {
"type": "string",
"nullable": true
},
"additionalChatsIndex": {
"type": "number"
},
"additionalStorageIndex": {
"type": "number"
},
"chatsLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"chatsLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"customChatsLimit": {
"type": "number",
"nullable": true
},
"customStorageLimit": {
"type": "number",
"nullable": true
},
"customSeatsLimit": {
"type": "number",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
"additionalChatsIndex",
"additionalStorageIndex",
"chatsLimitFirstEmailSentAt",
"chatsLimitSecondEmailSentAt",
"storageLimitFirstEmailSentAt",
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
],
"additionalProperties": false
}
},
"required": [
"workspace"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"patch": {
"operationId": "mutation.workspace.updateWorkspace",
"summary": "Update workspace",
"tags": [
"Workspace"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"icon": {
"type": "string"
}
},
"additionalProperties": false
}
}
}
},
"parameters": [
{
"name": "workspaceId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspace": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"name": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
},
"stripeId": {
"type": "string",
"nullable": true
},
"additionalChatsIndex": {
"type": "number"
},
"additionalStorageIndex": {
"type": "number"
},
"chatsLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"chatsLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"customChatsLimit": {
"type": "number",
"nullable": true
},
"customStorageLimit": {
"type": "number",
"nullable": true
},
"customSeatsLimit": {
"type": "number",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
"additionalChatsIndex",
"additionalStorageIndex",
"chatsLimitFirstEmailSentAt",
"chatsLimitSecondEmailSentAt",
"storageLimitFirstEmailSentAt",
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
],
"additionalProperties": false
}
},
"required": [
"workspace"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"delete": {
"operationId": "mutation.workspace.deleteWorkspace",
"summary": "Delete workspace",
"tags": [
"Workspace"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/workspaces/{workspaceId}/members": {
"get": {
"operationId": "query.workspace.listMembersInWorkspace",
"summary": "List members in workspace",
"tags": [
"Workspace"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"workspaceId": {
"type": "string"
},
"user": {
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true
},
"email": {
"type": "string",
"nullable": true
},
"image": {
"type": "string",
"nullable": true
}
},
"required": [
"name",
"email",
"image"
],
"additionalProperties": false
},
"role": {
"type": "string",
"enum": [
"ADMIN",
"MEMBER",
"GUEST"
]
}
},
"required": [
"workspaceId",
"user",
"role"
],
"additionalProperties": false
}
}
},
"required": [
"members"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots": {
"get": {
"operationId": "query.typebot.listTypebots",
"summary": "List typebots",
"tags": [
"Typebot"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "folderId",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"typebots": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"id": {
"type": "string"
},
"publishedTypebotId": {
"type": "string"
}
},
"required": [
"name",
"icon",
"id"
],
"additionalProperties": false
}
}
},
"required": [
"typebots"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots/{typebotId}/webhookBlocks": {
"get": {
"operationId": "query.webhook.listWebhookBlocks",
"summary": "List webhook blocks",
"description": "Returns a list of all the webhook blocks that you can subscribe to.",
"tags": [
"Webhook"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"webhookBlocks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": [
"id",
"label"
],
"additionalProperties": false
}
}
},
"required": [
"webhookBlocks"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots/{typebotId}/webhookBlocks/{blockId}/getResultExample": {
"get": {
"operationId": "query.webhook.getResultExample",
"summary": "Get result example",
"description": "Returns \"fake\" result for webhook block to help you anticipate how the webhook will behave.",
"tags": [
"Webhook"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "blockId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"resultExample": {
"allOf": [
{
"type": "object",
"properties": {
"message": {
"type": "string",
"enum": [
"This is a sample result, it has been generated ⬇️"
]
},
"Submitted at": {
"type": "string"
}
},
"required": [
"message",
"Submitted at"
],
"additionalProperties": false
},
{
"type": "object",
"additionalProperties": {
"anyOf": [
{
"not": {}
},
{
"type": "string"
}
]
}
}
],
"description": "Can contain any fields."
}
},
"required": [
"resultExample"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots/{typebotId}/webhookBlocks/{blockId}/subscribe": {
"post": {
"operationId": "query.webhook.subscribeWebhook",
"summary": "Subscribe to webhook block",
"tags": [
"Webhook"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"required": [
"url"
],
"additionalProperties": false
}
}
}
},
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "blockId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"url": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"url"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots/{typebotId}/webhookBlocks/{blockId}/unsubscribe": {
"post": {
"operationId": "query.webhook.unsubscribeWebhook",
"summary": "Unsubscribe from webhook block",
"tags": [
"Webhook"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {},
"additionalProperties": false
}
}
}
},
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "blockId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"url": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"url"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots/{typebotId}/results": {
"get": {
"operationId": "query.results.getResults",
"summary": "List results",
"tags": [
"Results"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"required": true,
"schema": {
"type": "string",
"pattern": "^[0-9]{1,3}$"
}
},
{
"name": "cursor",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"typebotId": {
"type": "string"
},
"variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"value": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"id",
"name",
"value"
],
"additionalProperties": false
}
},
"isCompleted": {
"type": "boolean"
},
"hasStarted": {
"type": "boolean",
"nullable": true
},
"isArchived": {
"type": "boolean",
"nullable": true
},
"answers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"createdAt": {
"type": "string",
"format": "date-time"
},
"resultId": {
"type": "string"
},
"blockId": {
"type": "string"
},
"groupId": {
"type": "string"
},
"variableId": {
"type": "string",
"nullable": true
},
"content": {
"type": "string"
},
"storageUsed": {
"type": "number",
"nullable": true
}
},
"required": [
"createdAt",
"resultId",
"blockId",
"groupId",
"variableId",
"content",
"storageUsed"
],
"additionalProperties": false
}
}
},
"required": [
"id",
"createdAt",
"typebotId",
"variables",
"isCompleted",
"hasStarted",
"isArchived",
"answers"
],
"additionalProperties": false
}
},
"nextCursor": {
"type": "string",
"nullable": true
}
},
"required": [
"results"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"delete": {
"operationId": "mutation.results.deleteResults",
"summary": "Delete results",
"tags": [
"Results"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "resultIds",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Comma separated list of ids. If not provided, all results will be deleted. ⚠️"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/typebots/{typebotId}/results/{resultId}/logs": {
"get": {
"operationId": "query.results.getResultLogs",
"summary": "List result logs",
"tags": [
"Results"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "resultId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"logs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"resultId": {
"type": "string"
},
"status": {
"type": "string"
},
"description": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"resultId",
"status",
"description",
"details"
],
"additionalProperties": false
}
}
},
"required": [
"logs"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/billing/subscription/portal": {
"get": {
"operationId": "query.billing.getBillingPortalUrl",
"summary": "Get Stripe billing portal URL",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"billingPortalUrl": {
"type": "string"
}
},
"required": [
"billingPortalUrl"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/billing/invoices": {
"get": {
"operationId": "query.billing.listInvoices",
"summary": "List invoices",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"invoices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"url": {
"type": "string"
},
"amount": {
"type": "number"
},
"currency": {
"type": "string"
},
"date": {
"type": "number",
"nullable": true
}
},
"required": [
"id",
"url",
"amount",
"currency",
"date"
],
"additionalProperties": false
}
}
},
"required": [
"invoices"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/billing/subscription": {
"delete": {
"operationId": "mutation.billing.cancelSubscription",
"summary": "Cancel current subscription",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"enum": [
"success"
]
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"patch": {
"operationId": "mutation.billing.updateSubscription",
"summary": "Update subscription",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspaceId": {
"type": "string"
},
"plan": {
"type": "string",
"enum": [
"STARTER",
"PRO"
]
},
"additionalChats": {
"type": "number"
},
"additionalStorage": {
"type": "number"
},
"currency": {
"type": "string",
"enum": [
"usd",
"eur"
]
}
},
"required": [
"workspaceId",
"plan",
"additionalChats",
"additionalStorage",
"currency"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspace": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"name": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM",
"UNLIMITED"
]
},
"stripeId": {
"type": "string",
"nullable": true
},
"additionalChatsIndex": {
"type": "number"
},
"additionalStorageIndex": {
"type": "number"
},
"chatsLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"chatsLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitFirstEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"storageLimitSecondEmailSentAt": {
"type": "string",
"format": "date-time",
"nullable": true
},
"customChatsLimit": {
"type": "number",
"nullable": true
},
"customStorageLimit": {
"type": "number",
"nullable": true
},
"customSeatsLimit": {
"type": "number",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
"additionalChatsIndex",
"additionalStorageIndex",
"chatsLimitFirstEmailSentAt",
"chatsLimitSecondEmailSentAt",
"storageLimitFirstEmailSentAt",
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
],
"additionalProperties": false
}
},
"required": [
"workspace"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"get": {
"operationId": "query.billing.getSubscription",
"summary": "List invoices",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"subscription": {
"type": "object",
"properties": {
"additionalChatsIndex": {
"type": "number"
},
"additionalStorageIndex": {
"type": "number"
},
"currency": {
"type": "string",
"enum": [
"eur",
"usd"
]
}
},
"required": [
"additionalChatsIndex",
"additionalStorageIndex",
"currency"
],
"additionalProperties": false
}
},
"required": [
"subscription"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/billing/subscription/checkout": {
"post": {
"operationId": "mutation.billing.createCheckoutSession",
"summary": "Create checkout session to create a new subscription",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"company": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"prefilledEmail": {
"type": "string"
},
"currency": {
"type": "string",
"enum": [
"usd",
"eur"
]
},
"plan": {
"type": "string",
"enum": [
"STARTER",
"PRO"
]
},
"returnUrl": {
"type": "string"
},
"additionalChats": {
"type": "number"
},
"additionalStorage": {
"type": "number"
},
"vat": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"type",
"value"
],
"additionalProperties": false
}
},
"required": [
"email",
"company",
"workspaceId",
"currency",
"plan",
"returnUrl",
"additionalChats",
"additionalStorage"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"checkoutUrl": {
"type": "string"
}
},
"required": [
"checkoutUrl"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/billing/usage": {
"get": {
"operationId": "query.billing.getUsage",
"summary": "Get current plan usage",
"tags": [
"Billing"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"totalChatsUsed": {
"type": "number"
},
"totalStorageUsed": {
"type": "number"
}
},
"required": [
"totalChatsUsed",
"totalStorageUsed"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/credentials": {
"post": {
"operationId": "mutation.credentials.createCredentials",
"summary": "Create credentials",
"tags": [
"Credentials"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"credentials": {
"anyOf": [
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"live": {
"type": "object",
"properties": {
"secretKey": {
"type": "string"
},
"publicKey": {
"type": "string"
}
},
"required": [
"secretKey",
"publicKey"
],
"additionalProperties": false
},
"test": {
"type": "object",
"properties": {
"secretKey": {
"type": "string"
},
"publicKey": {
"type": "string"
}
},
"additionalProperties": false
}
},
"required": [
"live",
"test"
],
"additionalProperties": false
},
"type": {
"type": "string",
"enum": [
"stripe"
]
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"data",
"type",
"workspaceId",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"host": {
"type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
},
"isTlsEnabled": {
"type": "boolean"
},
"port": {
"type": "number"
},
"from": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
}
},
"additionalProperties": false
}
},
"required": [
"port",
"from"
],
"additionalProperties": false
},
"type": {
"type": "string",
"enum": [
"smtp"
]
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"data",
"type",
"workspaceId",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"refresh_token": {
"type": "string",
"nullable": true
},
"expiry_date": {
"type": "number",
"nullable": true
},
"access_token": {
"type": "string",
"nullable": true
},
"token_type": {
"type": "string",
"nullable": true
},
"id_token": {
"type": "string",
"nullable": true
},
"scope": {
"type": "string"
}
},
"additionalProperties": false
},
"type": {
"type": "string",
"enum": [
"google sheets"
]
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"data",
"type",
"workspaceId",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"apiKey": {
"type": "string"
}
},
"required": [
"apiKey"
],
"additionalProperties": false
},
"type": {
"type": "string",
"enum": [
"openai"
]
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"data",
"type",
"workspaceId",
"name"
],
"additionalProperties": false
}
]
}
},
"required": [
"credentials"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"credentialsId": {
"type": "string"
}
},
"required": [
"credentialsId"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"get": {
"operationId": "query.credentials.listCredentials",
"summary": "List workspace credentials",
"tags": [
"Credentials"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "type",
"in": "query",
"required": true,
"schema": {
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"type": "string",
"enum": [
"stripe"
]
},
{
"type": "string",
"enum": [
"smtp"
]
}
]
},
{
"type": "string",
"enum": [
"google sheets"
]
}
]
},
{
"type": "string",
"enum": [
"openai"
]
}
]
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"credentials": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"additionalProperties": false
}
}
},
"required": [
"credentials"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/credentials/:credentialsId": {
"delete": {
"operationId": "mutation.credentials.deleteCredentials",
"summary": "Delete credentials",
"tags": [
"Credentials"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"name": "credentialsId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"credentialsId": {
"type": "string"
}
},
"required": [
"credentialsId"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
}
},
"components": {
"securitySchemes": {
"Authorization": {
"type": "http",
"scheme": "bearer"
}
},
"responses": {
"error": {
"description": "Error response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"code": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
},
"required": [
"message",
"code"
],
"additionalProperties": false
}
}
}
}
}
},
"externalDocs": {
"url": "https://docs.typebot.io/api"
}
}