2
0
Files
bot/apps/docs/openapi/builder/_spec_.json
2022-11-30 13:57:28 +01:00

1427 lines
43 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "Builder API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://app.typebot.io/api/v1"
}
],
"paths": {
"/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"
]
}
},
"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"
},
"name": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM"
]
},
"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",
"name",
"createdAt",
"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"
},
"name": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM"
]
},
"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",
"name",
"createdAt",
"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"
},
"name": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"icon": {
"type": "string",
"nullable": true
},
"plan": {
"type": "string",
"enum": [
"FREE",
"STARTER",
"PRO",
"LIFETIME",
"OFFERED",
"CUSTOM"
]
},
"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",
"name",
"createdAt",
"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",
"nullable": true
}
},
"required": [
"name",
"icon",
"id",
"publishedTypebotId"
],
"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}/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}/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 field."
}
},
"required": [
"resultExample"
],
"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": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"typebotId": {
"type": "string"
},
"variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"id",
"name",
"value"
],
"additionalProperties": false
}
},
"isCompleted": {
"type": "boolean"
},
"hasStarted": {
"type": "boolean",
"nullable": true
},
"isArchived": {
"type": "boolean",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"typebotId",
"variables",
"isCompleted",
"hasStarted",
"isArchived"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"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": [
"answers"
],
"additionalProperties": false
}
]
}
},
"nextCursor": {
"anyOf": [
{
"not": {}
},
{
"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": {}
}
},
"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"
}
}
}
}
},
"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"
}
}