{
  "openapi": "3.1.0",
  "info": {
    "title": "SuperCool API",
    "version": "1.0.0",
    "summary": "One agent, one endpoint. Send a message; get back finished work.",
    "description": "The SuperCool API gives your code the same agent you talk to in the SuperCool app.\nSend it a plain-language message and it plans the work, runs the tools and hands\nback the result: videos, images, websites, decks, research and writing.\n\nAll requests go to `https://api.supercool.com/v1` with an API key in the\n`Authorization` header. Every response carries a `Request-Id` header.\n",
    "contact": {
      "name": "SuperCool",
      "url": "https://supercool.com/docs/api"
    },
    "termsOfService": "https://supercool.com/terms"
  },
  "externalDocs": {
    "description": "Guides",
    "url": "https://supercool.com/docs/api"
  },
  "servers": [
    {
      "url": "https://api.supercool.com/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Messages",
      "description": "Talk to your agent and follow the work it starts."
    },
    {
      "name": "Uploads",
      "description": "Attach large files (up to 500 MB each) to a message."
    },
    {
      "name": "Work",
      "description": "The chats your agent works in, the same ones you see in the app."
    },
    {
      "name": "Files",
      "description": "Download what the agent made."
    },
    {
      "name": "Account",
      "description": "Who the key belongs to, the plan, credits and limits."
    },
    {
      "name": "Webhooks",
      "description": "Get pushed events instead of polling."
    },
    {
      "name": "CRM",
      "description": "The CRM API behind the SuperCool Zapier app: contacts, tags, opportunities, tasks, workflows, texts and emails, REST hook triggers and the Lead API. Base URL `https://api.supercool.com/api/v1/crm-app` (not `/v1`), the same API keys, `X-Workspace-Id` for a team's CRM, and errors shaped `{\"detail\": …}`. Guide: [CRM](/docs/api/crm)."
    }
  ],
  "paths": {
    "/messages": {
      "post": {
        "operationId": "createMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Send a message",
        "description": "Sends your agent a message, optionally with files. The call returns within about 30\nseconds: either the finished answer, or `status: \"processing\"` when the agent started\nlonger work. Follow a processing message with\n[`GET /messages/{message_id}`](#get-message) (use `?wait=` to long-poll), its\n[events](#list-message-events), or a [webhook](/docs/api/webhooks).\n\nReturns `201` for a new message and `200` when an `Idempotency-Key` replays an\nexisting one. Running out of credits is not an error: the message comes back with\n`status: \"blocked\"` and `reason: \"out_of_credits\"`. Neither is the running-jobs cap:\nwork the agent can't start because 5 jobs are already running comes back as a\n`blocked` job with `reason: \"too_many_running\"`, and the message lists the `running` work.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageCreate"
              },
              "example": {
                "message": "A 15 second vertical ad for my candle shop, warm and cozy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An `Idempotency-Key` you already used with the same body. The same message, as it is now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          },
          "201": {
            "description": "The message was accepted. It is either final already or `processing`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                },
                "example": {
                  "id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d",
                  "object": "message",
                  "status": "processing",
                  "reason": null,
                  "question": null,
                  "final": false,
                  "reply": "On it. I'm making a 15 second vertical ad with warm candlelight shots.",
                  "jobs": [
                    {
                      "job_id": "exe_9b2c4d6e8f0a1b3c5d7e9f1a2b4c6d8e",
                      "kind": "execution",
                      "role": "execution",
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "title": "Candle shop vertical ad",
                      "status": "running",
                      "reason": null,
                      "final": false,
                      "queued": null,
                      "resume_by": null,
                      "link": "https://supercool.com/chat/5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "started_at": "2026-09-30T14:02:11.402000Z",
                      "settled_at": null,
                      "files": []
                    }
                  ],
                  "files": [],
                  "notes": [],
                  "credits_used": 0,
                  "created_at": "2026-09-30T14:02:03.118000Z",
                  "updated_at": "2026-09-30T14:02:12.950000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "empty_message",
          "too_long",
          "too_many",
          "unauthorized",
          "not_found",
          "idempotency_conflict",
          "upload_not_ready",
          "too_large",
          "rate_limited"
        ]
      }
    },
    "/messages/{message_id}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Get a message",
        "description": "One message: its status, the agent's reply, the jobs it started and the files they\nmade. With `wait`, the call holds for up to that many seconds and returns as soon as\nsomething changes (the status, the reply arriving, or a job's status) or the message\nis final.\n\nMessages are kept for at least 14 days after their last job's deadline. After that\nthis returns `404 not_found`; read the work instead ([`GET /work/{work_id}`](#get-work)).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MessageId"
          },
          {
            "name": "wait",
            "in": "query",
            "required": false,
            "description": "Long-poll for up to this many seconds (0 to 45). `0` returns immediately.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 45,
              "default": 0
            },
            "example": 30
          }
        ],
        "responses": {
          "200": {
            "description": "The message.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                },
                "example": {
                  "id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d",
                  "object": "message",
                  "status": "completed",
                  "reason": null,
                  "question": null,
                  "final": true,
                  "reply": "On it. I'm making a 15 second vertical ad with warm candlelight shots.",
                  "jobs": [
                    {
                      "job_id": "exe_9b2c4d6e8f0a1b3c5d7e9f1a2b4c6d8e",
                      "kind": "execution",
                      "role": "execution",
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "title": "Candle shop vertical ad",
                      "status": "completed",
                      "reason": null,
                      "final": true,
                      "queued": null,
                      "resume_by": null,
                      "link": "https://supercool.com/chat/5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "started_at": "2026-09-30T14:02:11.402000Z",
                      "settled_at": "2026-09-30T14:06:40.221000Z",
                      "files": [
                        {
                          "file_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f/candle_ad.mp4",
                          "name": "candle_ad.mp4",
                          "content_type": "video/mp4",
                          "kind": "video",
                          "size": 4812345,
                          "url": "https://api.supercool.sh/api/v1/files/s/eyJmIjoiNWQwYzNl...",
                          "revision": "\"5b1c0e6f9d2a4b7c8e1f3a5d7c9b0e2f\"",
                          "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                          "label": null
                        }
                      ]
                    }
                  ],
                  "files": [
                    {
                      "file_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f/candle_ad.mp4",
                      "name": "candle_ad.mp4",
                      "content_type": "video/mp4",
                      "kind": "video",
                      "size": 4812345,
                      "url": "https://api.supercool.sh/api/v1/files/s/eyJmIjoiNWQwYzNl...",
                      "revision": "\"5b1c0e6f9d2a4b7c8e1f3a5d7c9b0e2f\"",
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "label": null
                    }
                  ],
                  "notes": [],
                  "credits_used": 42.5,
                  "created_at": "2026-09-30T14:02:03.118000Z",
                  "updated_at": "2026-09-30T14:02:12.950000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/messages/{message_id}/events": {
      "get": {
        "operationId": "listMessageEvents",
        "tags": [
          "Messages"
        ],
        "summary": "List a message's events",
        "description": "The message's update log, oldest first: progress steps, late replies, each job's\nresult with its files, and state changes. Only this message's entries: another\nmessage's progress in the same chat isn't included. Pass back the `cursor` from the previous\npage to get only what's new. With no cursor, the log starts where the message\nstarted. `done` is `true` once the message has nothing more to report.\n\nThe call waits at least one second, and up to `wait` seconds, for new entries. Only\none wait per message runs at a time (`409 poll_in_progress` otherwise). Entries are\nkept for 7 days; a cursor older than that returns `cursor_expired: true` with a fresh\ncursor.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MessageId"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `cursor` from the previous page. Opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "wait",
            "in": "query",
            "required": false,
            "description": "Wait up to this many seconds for new entries (0 to 45; at least 1 second is always waited).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 45,
              "default": 0
            },
            "example": 30
          }
        ],
        "responses": {
          "200": {
            "description": "A page of events.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "seq": 118,
                      "type": "progress",
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "message_id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d",
                      "at": "2026-09-30T14:03:02.000000Z",
                      "step": "Rendering the video",
                      "status": "started",
                      "file_names": []
                    },
                    {
                      "seq": 121,
                      "type": "result",
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "message_id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d",
                      "at": "2026-09-30T14:06:40.000000Z",
                      "title": "Candle shop vertical ad",
                      "text": "Your 15 second ad is ready.",
                      "outcome": "completed",
                      "files": []
                    }
                  ],
                  "has_more": false,
                  "done": true,
                  "cursor": "eyJjIjoiYXBpOnU..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "bad_cursor",
          "unauthorized",
          "not_found",
          "poll_in_progress",
          "rate_limited"
        ]
      }
    },
    "/messages/{message_id}/recover": {
      "post": {
        "operationId": "recoverMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Recover a message's results",
        "description": "For work that outlived its watch (a job or message that `expired`): re-arms the watch\nso the result is looked up again and lands in the message, its events and your\nwebhooks. It never resends the message or starts new work. One entry per piece of\nwork: `settled` (already has its outcome), `watching` (still being watched),\n`recovering` (re-armed now) or `exhausted` (recovered too many times; read the work).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MessageId"
          }
        ],
        "responses": {
          "200": {
            "description": "What happened to each piece of work.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Recovery"
                },
                "example": {
                  "id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d",
                  "object": "recovery",
                  "work": [
                    {
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "state": "recovering"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/messages/{message_id}/cancel": {
      "post": {
        "operationId": "cancelMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Cancel a message's work",
        "description": "Stops the work a message started. Work still queued (for credits, or for its chat) is\nremoved before it runs; work running now is stopped when it is this message's own run\n(other work in the same chat is never stopped) and settles as `cancelled` a moment\nlater with the credits it used; work the agent starts for the message after this is\ncancelled as it arrives. Credits already used stay on `credits_used`.\nReturns the message, plus `cancelled` (job ids stopped) and `not_cancellable` (job ids\nthat couldn't be, such as a follow-up that joined another message's running work).\nCancelling finished work changes nothing.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/MessageId"
          }
        ],
        "responses": {
          "200": {
            "description": "The message after cancelling.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Message"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "cancelled": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Job ids this request stopped."
                        },
                        "not_cancellable": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Job ids that couldn't be stopped."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/uploads": {
      "post": {
        "operationId": "createUpload",
        "tags": [
          "Uploads"
        ],
        "summary": "Start an upload",
        "description": "Starts a large upload (up to 500 MB). Returns a presigned POST: send a\n`multipart/form-data` POST to `url` with every entry of `fields` as form fields and\nthe file last, as a field named `file`. The link is valid for 15 minutes. Then call\n[`POST /uploads/{upload_id}/complete`](#complete-upload) and pass the `upload_id` in a\nmessage's `upload_ids`. Uploads never attached to a message are deleted after 24 hours.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadCreate"
              },
              "example": {
                "filename": "product-shoot.mov",
                "size": 157286400,
                "content_type": "video/quicktime"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The upload was created. POST the file to `url` next.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadCreated"
                },
                "example": {
                  "object": "upload",
                  "upload_id": "up_0a1b2c3d4e5f60718293a4b5c6d7e8f9",
                  "url": "https://supercool-uploads.s3.amazonaws.com/",
                  "fields": {
                    "key": "agent-uploads/incoming/.../product-shoot.mov",
                    "Content-Type": "video/quicktime",
                    "policy": "eyJleHBpcmF0aW9uIjoi...",
                    "x-amz-signature": "3f1c..."
                  },
                  "expires_at": "2026-09-30T14:17:03.118000Z",
                  "max_bytes": 157286400
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "bad_size",
          "unauthorized",
          "too_large",
          "rate_limited"
        ]
      }
    },
    "/uploads/{upload_id}/complete": {
      "post": {
        "operationId": "completeUpload",
        "tags": [
          "Uploads"
        ],
        "summary": "Complete an upload",
        "description": "Finalizes an upload after the file was POSTed to the presigned `url`. The file is\nchecked (its real size, and executables are refused) and becomes `ready` to attach.\nCalling it again on a ready upload returns the same result.\n",
        "parameters": [
          {
            "name": "upload_id",
            "in": "path",
            "required": true,
            "description": "The `upload_id` from `POST /uploads` (`up_…`).",
            "schema": {
              "type": "string"
            },
            "example": "up_0a1b2c3d4e5f60718293a4b5c6d7e8f9"
          }
        ],
        "responses": {
          "200": {
            "description": "The upload is ready to attach.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                },
                "example": {
                  "object": "upload",
                  "upload_id": "up_0a1b2c3d4e5f60718293a4b5c6d7e8f9",
                  "status": "ready",
                  "filename": "product-shoot.mov",
                  "content_type": "video/quicktime",
                  "size": 157286400
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "not_pending",
          "not_uploaded",
          "changed",
          "too_large",
          "executable_refused",
          "rate_limited"
        ]
      }
    },
    "/work": {
      "get": {
        "operationId": "listWork",
        "tags": [
          "Work"
        ],
        "summary": "List recent work",
        "description": "Your agent's recent work (chats), newest first: the same list you see in the app,\nwhether the work was started over the API, in the app, by phone or anywhere else.\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return (1 to 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            },
            "example": 10
          }
        ],
        "responses": {
          "200": {
            "description": "Recent work.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "work",
                      "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                      "title": "Candle shop vertical ad",
                      "preview": "Your 15 second ad is ready.",
                      "link": "https://supercool.com/chat/5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "unauthorized",
          "rate_limited"
        ]
      }
    },
    "/work/{work_id}": {
      "get": {
        "operationId": "getWork",
        "tags": [
          "Work"
        ],
        "summary": "Get a piece of work",
        "description": "One piece of work: whether it's running, the latest result text (paged with\n`from_char` / `next_from_char`) and its most recent files (up to 8), each with a\nfresh download link.\n",
        "parameters": [
          {
            "name": "work_id",
            "in": "path",
            "required": true,
            "description": "The `work_id` from a job, an event or `GET /work`.",
            "schema": {
              "type": "string"
            },
            "example": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f"
          },
          {
            "name": "from_char",
            "in": "query",
            "required": false,
            "description": "Read the text from this character on (use the previous `next_from_char`).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The work.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Work"
                },
                "example": {
                  "object": "work",
                  "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                  "title": "Candle shop vertical ad",
                  "status": "idle",
                  "text": "Your 15 second ad is ready. I used warm, slow push-ins on the candles...",
                  "next_from_char": null,
                  "link": "https://supercool.com/chat/5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                  "files": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/files/{file_id}": {
      "get": {
        "operationId": "getFile",
        "tags": [
          "Files"
        ],
        "summary": "Get a file",
        "description": "A file's record with a fresh signed download link. Use it when a `url` has expired,\nor when a download answered `412` because the file changed since the link was made.\nFile ids contain slashes (`<work_id>/<path>`); put them in the path as they are.\n",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "description": "The `file_id` from a message, job, event or work (`<work_id>/<path>`, slashes included).",
            "schema": {
              "type": "string"
            },
            "example": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f/candle_ad.mp4"
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileObject"
                },
                "example": {
                  "object": "file",
                  "file_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f/candle_ad.mp4",
                  "name": "candle_ad.mp4",
                  "content_type": "video/mp4",
                  "kind": "video",
                  "size": 4812345,
                  "url": "https://api.supercool.sh/api/v1/files/s/eyJmIjoiNWQwYzNl...",
                  "revision": "\"5b1c0e6f9d2a4b7c8e1f3a5d7c9b0e2f\"",
                  "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                  "label": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/me": {
      "get": {
        "operationId": "getAccount",
        "tags": [
          "Account"
        ],
        "summary": "Get the account",
        "description": "The account the API key belongs to, its plan, available credits, the agent's name, the key itself and your limits.",
        "responses": {
          "200": {
            "description": "The account.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                },
                "example": {
                  "object": "account",
                  "user_id": "64f1c2a9e4b0a1b2c3d4e5f6",
                  "email": "you@example.com",
                  "name": "Sam Rivera",
                  "plan": "pro",
                  "credits": 1840,
                  "agent": {
                    "name": "Nova"
                  },
                  "key": {
                    "id": "pat:6a1b2c3d4e5f",
                    "name": "prod server"
                  },
                  "limits": {
                    "running_jobs": 5,
                    "requests_per_minute": 600
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "rate_limited"
        ]
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "The account's webhook endpoints (up to 10).",
        "responses": {
          "200": {
            "description": "The endpoints.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "webhook_endpoint",
                      "id": "whe_4c1d2e3f4a5b6c7d8e9f",
                      "url": "https://example.com/hooks/supercool",
                      "events": [
                        "*"
                      ],
                      "description": "prod",
                      "created_at": "2026-09-30T13:40:00.000000Z",
                      "disabled_at": null,
                      "disabled_reason": null,
                      "failing_since": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "rate_limited"
        ]
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "description": "Registers a public `https` URL (port 443 or 8443) to receive events. The response\nincludes the endpoint's signing `secret` (`whsec_…`). It is shown only this once:\nstore it now. Omit `events` (or pass `[\"*\"]`) to receive every event.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreate"
              },
              "example": {
                "url": "https://example.com/hooks/supercool",
                "events": [
                  "message.completed",
                  "message.failed",
                  "message.blocked"
                ],
                "description": "prod"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The endpoint, with its secret (shown once).",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                },
                "example": {
                  "object": "webhook_endpoint",
                  "id": "whe_4c1d2e3f4a5b6c7d8e9f",
                  "url": "https://example.com/hooks/supercool",
                  "events": [
                    "message.completed",
                    "message.failed",
                    "message.blocked"
                  ],
                  "description": "prod",
                  "created_at": "2026-09-30T13:40:00.000000Z",
                  "disabled_at": null,
                  "disabled_reason": null,
                  "failing_since": null,
                  "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "bad_url",
          "bad_events",
          "bad_request",
          "unauthorized",
          "too_many_endpoints",
          "rate_limited"
        ]
      }
    },
    "/webhooks/{endpoint_id}": {
      "get": {
        "operationId": "getWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook endpoint",
        "description": "One endpoint and its 20 most recent deliveries.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointId"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDetail"
                },
                "example": {
                  "object": "webhook_endpoint",
                  "id": "whe_4c1d2e3f4a5b6c7d8e9f",
                  "url": "https://example.com/hooks/supercool",
                  "events": [
                    "*"
                  ],
                  "description": "prod",
                  "created_at": "2026-09-30T13:40:00.000000Z",
                  "disabled_at": null,
                  "disabled_reason": null,
                  "failing_since": null,
                  "recent_deliveries": [
                    {
                      "object": "webhook_delivery",
                      "id": "evt_7d8e9f0a1b2c3d4e5f6a7b8c",
                      "event": "message.completed",
                      "status": "delivered",
                      "attempts": 1,
                      "last_status_code": 200,
                      "last_error": null,
                      "last_response": "ok",
                      "last_ms": 184,
                      "created_at": "2026-09-30T14:06:41.000000Z",
                      "delivered_at": "2026-09-30T14:06:41.000000Z",
                      "next_attempt_at": "2026-09-30T14:06:41.000000Z",
                      "message_id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      },
      "patch": {
        "operationId": "updateWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "description": "Changes an endpoint's URL, events or description, or turns it off and on. Send only\nthe fields to change. `\"enabled\": true` turns a disabled endpoint back on (after you\nfixed it) and clears its failure state.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookUpdate"
              },
              "example": {
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated endpoint.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "invalid_request",
          "bad_url",
          "bad_events",
          "bad_request",
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      },
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "Deletes the endpoint. Deliveries still waiting to be sent to it are cancelled.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "example": {
                  "object": "webhook_endpoint",
                  "id": "whe_4c1d2e3f4a5b6c7d8e9f",
                  "deleted": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/webhooks/{endpoint_id}/rotate-secret": {
      "post": {
        "operationId": "rotateWebhookSecret",
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate a signing secret",
        "description": "Replaces the endpoint's signing secret and returns the new one (shown once). Every\ndelivery from now on is signed with the new secret, including retries of earlier\nevents.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointId"
          }
        ],
        "responses": {
          "200": {
            "description": "The new secret.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotatedSecret"
                },
                "example": {
                  "object": "webhook_endpoint",
                  "id": "whe_4c1d2e3f4a5b6c7d8e9f",
                  "secret": "whsec_Q2hhbmdlZC1zZWNyZXQtZXhhbXBsZTEy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "x-errors": [
          "unauthorized",
          "not_found",
          "rate_limited"
        ]
      }
    },
    "/zapier/me": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmGetMe",
        "tags": [
          "CRM"
        ],
        "summary": "Test a key",
        "description": "Checks the API key and returns who it belongs to and which CRM it reaches: the key\nowner's personal CRM, or the team named by `X-Workspace-Id`. Zapier calls it when\nan account is connected and shows `label` as the connection's name.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The key, its owner and the CRM.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmAccount"
                },
                "example": {
                  "ok": true,
                  "user_id": "64f1c2a9e4b0a1b2c3d4e5f6",
                  "email": "you@example.com",
                  "workspace_id": "6650a1b2c3d4e5f6a7b8c9d0",
                  "team_name": "Rivera Studio",
                  "role": "admin",
                  "key": {
                    "id": "pat:6a1b2c3d4e5f",
                    "name": "Zapier",
                    "hint": "sc_key_9fK2…x7Qa"
                  },
                  "label": "you@example.com · Rivera Studio"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/triggers": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListTriggers",
        "tags": [
          "CRM"
        ],
        "summary": "List triggers",
        "description": "Every trigger key a REST hook can subscribe to, with the CRM event types it fires on. See the [trigger catalogue](/docs/api/crm#trigger-catalogue).",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The triggers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmTriggerList"
                },
                "example": {
                  "items": [
                    {
                      "key": "new_contact",
                      "label": "New Contact",
                      "noun": "Contact",
                      "types": [
                        "contact.created"
                      ]
                    },
                    {
                      "key": "lead_received",
                      "label": "Lead Received",
                      "noun": "Lead",
                      "types": [
                        "facebook.lead_received",
                        "form.submitted"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/hooks": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListHooks",
        "tags": [
          "CRM"
        ],
        "summary": "List REST hook subscriptions",
        "description": "The CRM's REST hook subscriptions, newest first, whichever key created them.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The subscriptions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmHookList"
                },
                "example": {
                  "items": [
                    {
                      "id": "zh_4c1d2e3f4a5b6c7d8e9f",
                      "key_id": "pat:6a1b2c3d4e5f",
                      "event": "new_contact",
                      "label": "New Contact",
                      "target_url": "https://hooks.example.com/supercool/new-contact",
                      "target_host": "hooks.example.com",
                      "key_name": "Zapier",
                      "key_hint": "sc_key_9fK2…x7Qa",
                      "deliveries": 12,
                      "failures": 0,
                      "last_delivery_at": "2026-10-23T14:02:12.010000Z",
                      "last_status": 200,
                      "last_error": null,
                      "created_at": "2026-10-23T13:40:00Z",
                      "updated_at": "2026-10-23T14:02:12.010000Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "crmSubscribeHook",
        "tags": [
          "CRM"
        ],
        "summary": "Subscribe a REST hook",
        "description": "Subscribes `target_url` to one trigger. Each matching CRM event is then POSTed to it\n(see [Delivery](/docs/api/crm#delivery)). Subscribing the same URL to the same\ntrigger again returns the existing subscription. Up to 100 subscriptions per CRM.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmHookCreate"
              },
              "example": {
                "event": "new_contact",
                "target_url": "https://hooks.example.com/supercool/new-contact"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmHook"
                },
                "example": {
                  "id": "zh_4c1d2e3f4a5b6c7d8e9f",
                  "key_id": "pat:6a1b2c3d4e5f",
                  "event": "new_contact",
                  "label": "New Contact",
                  "target_url": "https://hooks.example.com/supercool/new-contact",
                  "target_host": "hooks.example.com",
                  "key_name": "Zapier",
                  "key_hint": "sc_key_9fK2…x7Qa",
                  "deliveries": 0,
                  "failures": 0,
                  "last_delivery_at": null,
                  "last_status": null,
                  "last_error": null,
                  "created_at": "2026-10-23T13:40:00Z",
                  "updated_at": "2026-10-23T13:40:00Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "422": {
            "$ref": "#/components/responses/CrmUnprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      },
      "delete": {
        "operationId": "crmUnsubscribeHooks",
        "tags": [
          "CRM"
        ],
        "summary": "Unsubscribe by id or URL",
        "description": "Removes a subscription by `id`, or every subscription to `target_url` (only the one\nfor `event`, if you send it). Events still waiting to be delivered to them are\ndropped. `400` without `id` or `target_url`; `404` when nothing matches.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmHookDelete"
              },
              "example": {
                "target_url": "https://hooks.example.com/supercool/new-contact",
                "event": "new_contact"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmOk"
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/hooks/{hook_id}": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "delete": {
        "operationId": "crmUnsubscribeHook",
        "tags": [
          "CRM"
        ],
        "summary": "Unsubscribe a REST hook",
        "description": "Removes one subscription. Events still waiting to be delivered to it are dropped.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmHookId"
          },
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmOk"
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/perform-list/{event}": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmSampleEvents",
        "tags": [
          "CRM"
        ],
        "summary": "Get sample events",
        "description": "Up to 3 of the CRM's most recent events for a trigger, newest first, in the payload a\nsubscription receives. With none yet, one made-up sample (`\"id\": \"ev_sample\"`).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTriggerKey"
          },
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmEventList"
                },
                "example": {
                  "items": [
                    {
                      "id": "ev_3f9a1c2e7b8d4e5f6a7b",
                      "trigger": "tag_added",
                      "type": "contact.tag_added",
                      "label": "Contact tag added",
                      "occurred_at": "2026-10-23T14:02:11.402000Z",
                      "contact_id": "ct_8f2a6c1e9b3d5f7a0c4e",
                      "contact": {
                        "id": "ct_8f2a6c1e9b3d5f7a0c4e",
                        "email": "jane@example.com",
                        "phone": "+15555550123",
                        "first_name": "Jane",
                        "last_name": "Doe",
                        "full_name": "Jane Doe",
                        "company": "Example Co",
                        "address": null,
                        "city": "Austin",
                        "state": "TX",
                        "postal_code": "78701",
                        "country": "US",
                        "website": null,
                        "source": "zapier",
                        "owner_user_id": null,
                        "fields": {},
                        "tag_ids": [
                          "tag_1a2b3c4d5e6f7a8b9c0d"
                        ],
                        "tags": [
                          "lead"
                        ],
                        "dnd": {
                          "email": false,
                          "sms": false,
                          "calls": false,
                          "all": false,
                          "reason": null,
                          "at": null
                        },
                        "consent": {
                          "email": "explicit",
                          "sms": null
                        },
                        "created_at": "2026-10-23T14:02:11.402000Z",
                        "updated_at": "2026-10-23T14:02:11.402000Z"
                      },
                      "data": {
                        "tag_id": "tag_1a2b3c4d5e6f7a8b9c0d",
                        "tag_name": "lead"
                      },
                      "ref": {},
                      "actor": {
                        "kind": "api_key",
                        "id": "pat:6a1b2c3d4e5f"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/contacts": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmCreateOrUpdateContact",
        "tags": [
          "CRM"
        ],
        "summary": "Create or update a contact",
        "description": "Finds the contact by `email`, then `phone`, and updates it, or creates it (source\n`zapier`). Only non-empty fields are written. `consent: true` records explicit email\nconsent and `sms_consent: true` explicit SMS consent; explicit consent is never\ndowngraded. Returns the contact at the top level, with `ok` and `created`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmContactWrite"
              },
              "example": {
                "email": "jane@example.com",
                "first_name": "Jane",
                "last_name": "Doe",
                "phone": "(555) 555-0123",
                "tags": "lead, webinar",
                "consent": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contact, created or updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmContactResult"
                },
                "example": {
                  "ok": true,
                  "created": true,
                  "id": "ct_8f2a6c1e9b3d5f7a0c4e",
                  "email": "jane@example.com",
                  "phone": "+15555550123",
                  "first_name": "Jane",
                  "last_name": "Doe",
                  "company": null,
                  "display_name": "Jane Doe",
                  "tags": [
                    "tag_1a2b3c4d5e6f7a8b9c0d",
                    "tag_0d9c8b7a6f5e4d3c2b1a"
                  ],
                  "fields": {},
                  "source": "zapier",
                  "owner_user_id": null,
                  "status": "active",
                  "dnd": {
                    "email": false,
                    "sms": false,
                    "calls": false,
                    "all": false,
                    "reason": null,
                    "at": null
                  },
                  "consent": {
                    "email": {
                      "status": "explicit",
                      "source": "zapier",
                      "at": "2026-10-23T14:02:11.402000Z"
                    },
                    "call": {
                      "status": "none",
                      "source": null,
                      "at": null
                    }
                  },
                  "last_activity_at": "2026-10-23T14:02:11.402000Z",
                  "created_at": "2026-10-23T14:02:11.402000Z",
                  "updated_at": "2026-10-23T14:02:11.402000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "422": {
            "$ref": "#/components/responses/CrmUnprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/contacts/update": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmUpdateContact",
        "tags": [
          "CRM"
        ],
        "summary": "Update a contact",
        "description": "Changes an existing contact, found by `contact_id`, `contact`, `email` or `phone`.\nOnly the fields you send change; `tags` are added. Custom field keys must exist.\n`consent` and `sms_consent` are ignored. `400 Nothing to update` without changes.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmContactWrite"
              },
              "example": {
                "contact": "jane@example.com",
                "company": "Example Co",
                "tags": [
                  "customer"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated contact, at the top level, with `ok`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmContactResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "422": {
            "$ref": "#/components/responses/CrmUnprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/contacts/find": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmFindContact",
        "tags": [
          "CRM"
        ],
        "summary": "Find a contact",
        "description": "Looks a contact up by id, then email, then phone. No match is an empty list, never a `404`.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": false,
            "description": "The contact's id (`ct_…`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contact",
            "in": "query",
            "required": false,
            "description": "An id, email address or phone number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "The contact's email address.",
            "schema": {
              "type": "string"
            },
            "example": "jane@example.com"
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "The contact's phone number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact, or an empty list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmContactList"
                },
                "example": {
                  "items": [
                    {
                      "id": "ct_8f2a6c1e9b3d5f7a0c4e",
                      "email": "jane@example.com",
                      "phone": "+15555550123",
                      "first_name": "Jane",
                      "last_name": "Doe",
                      "display_name": "Jane Doe",
                      "tags": [],
                      "fields": {},
                      "source": "zapier",
                      "status": "active"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/contacts/tags": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmAddTags",
        "tags": [
          "CRM"
        ],
        "summary": "Add tags to a contact",
        "description": "Adds tags by name; missing tags are created. Tags the contact already has change nothing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmTagsChange"
              },
              "example": {
                "contact_id": "ct_8f2a6c1e9b3d5f7a0c4e",
                "tags": [
                  "vip",
                  "webinar"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contact, at the top level, with `ok`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmContactResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/contacts/tags/remove": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmRemoveTags",
        "tags": [
          "CRM"
        ],
        "summary": "Remove tags from a contact",
        "description": "Removes tags given by name (ignoring case and extra spaces) or id (`tag_…`). Tags the contact doesn't have are skipped.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmTagsChange"
              },
              "example": {
                "email": "jane@example.com",
                "tags": "webinar"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contact, at the top level, with `ok`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmContactResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/opportunities": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmCreateOpportunity",
        "tags": [
          "CRM"
        ],
        "summary": "Create an opportunity",
        "description": "Opens an opportunity for a contact, in a pipeline and stage given by id or name (the\ndefault pipeline and its first stage when omitted). One open opportunity per\ncontact per pipeline unless `allow_duplicate`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmOpportunityCreate"
              },
              "example": {
                "email": "jane@example.com",
                "pipeline": "Sales",
                "stage": "Qualified",
                "value": "1500"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The opportunity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmOpportunity"
                },
                "example": {
                  "id": "opp_7d8e9f0a1b2c3d4e5f6a",
                  "pipeline_id": "pl_2b3c4d5e6f7a8b9c0d1e",
                  "stage_id": "st_5e6f7a8b9c0d1e2f3a4b",
                  "contact_id": "ct_8f2a6c1e9b3d5f7a0c4e",
                  "name": "Jane Doe",
                  "status": "open",
                  "value": 150000,
                  "currency": "usd",
                  "source": "zapier",
                  "owner_user_id": null,
                  "followers": [],
                  "tags": [],
                  "fields": {},
                  "lost_reason": null,
                  "expected_close_at": null,
                  "created_at": "2026-10-23T14:05:00.118000Z",
                  "updated_at": "2026-10-23T14:05:00.118000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "422": {
            "$ref": "#/components/responses/CrmUnprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/opportunities/{opportunity_id}/move": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmMoveOpportunity",
        "tags": [
          "CRM"
        ],
        "summary": "Move an opportunity",
        "description": "Moves an opportunity to another stage (by id or name), to another pipeline (its\nfirst stage unless a stage is given), and/or sets its status. Send at least one of\nstage, pipeline or status.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmOpportunityId"
          },
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmOpportunityMove"
              },
              "example": {
                "stage": "Proposal sent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The opportunity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmOpportunity"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/tasks": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmCreateTask",
        "tags": [
          "CRM"
        ],
        "summary": "Create a task",
        "description": "Adds a task, optionally on a contact (found like the other actions; `404` if given and not found).",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmTaskCreate"
              },
              "example": {
                "title": "Call Jane",
                "email": "jane@example.com",
                "due_date": "2026-10-27",
                "due_time": "10:00",
                "timezone": "America/Chicago"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmTask"
                },
                "example": {
                  "id": "tsk_1e2f3a4b5c6d7e8f9a0b",
                  "title": "Call Jane",
                  "description_html": null,
                  "contact_id": "ct_8f2a6c1e9b3d5f7a0c4e",
                  "opportunity_id": null,
                  "assigned_to": null,
                  "due_at": "2026-10-27T15:00:00Z",
                  "due_date": "2026-10-27",
                  "due_time": "10:00",
                  "all_day": false,
                  "timezone": "America/Chicago",
                  "status": "open",
                  "origin": {
                    "kind": "manual",
                    "reason": "Created by Zapier"
                  },
                  "created_at": "2026-10-23T14:08:00Z",
                  "updated_at": "2026-10-23T14:08:00Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "422": {
            "$ref": "#/components/responses/CrmUnprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/workflows/{workflow_id}/enroll": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmEnrollContact",
        "tags": [
          "CRM"
        ],
        "summary": "Add a contact to a workflow",
        "description": "Starts a published workflow for a contact. Not being enrolled is not an error: `ok`\nis `false` and `reason` says why (`already_active`, `no_reentry`, `not_published`).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmWorkflowId"
          },
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmContactLookup"
              },
              "example": {
                "email": "jane@example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmEnrollment"
                },
                "example": {
                  "ok": true,
                  "reason": "enrolled",
                  "enrollment_id": "wfe_6f7a8b9c0d1e2f3a4b5c",
                  "workflow_id": "wf_0a1b2c3d4e5f6a7b8c9d",
                  "workflow_name": "New lead follow-up",
                  "contact_id": "ct_8f2a6c1e9b3d5f7a0c4e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/messages/sms": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmSendText",
        "tags": [
          "CRM"
        ],
        "summary": "Send a text",
        "description": "Texts a contact from the CRM's phone number. A marketing send: the contact needs\nexplicit SMS consent, and DND, STOP opt-outs, quiet hours, daily limits and credits\napply. A refused send is `422` with a `reason`; nothing is sent or queued. See\n[Consent rules](/docs/api/crm#consent).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmTextSend"
              },
              "example": {
                "contact": "+15555550123",
                "text": "Hi Jane, your order shipped today."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sent (see `status`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmSent"
                },
                "example": {
                  "ok": true,
                  "contact_id": "ct_8f2a6c1e9b3d5f7a0c4e",
                  "id": "cmsg_9b2c4d6e8f0a1b3c5d7e",
                  "status": "accepted",
                  "kind": "sms",
                  "conversation_id": "cv_3c4d5e6f7a8b9c0d1e2f",
                  "segments": 1,
                  "credits": 10,
                  "error": null,
                  "created_at": "2026-10-23T14:10:02.551000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "422": {
            "$ref": "#/components/responses/CrmRefused"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/messages/email": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmSendEmail",
        "tags": [
          "CRM"
        ],
        "summary": "Send an email",
        "description": "Emails a contact from the CRM's default sender. A marketing send: the contact needs\nexplicit email consent, and DND, unsubscribes, bounces, daily limits and credits\napply. A refused send is `422` with a `reason`; nothing is sent or queued. See\n[Consent rules](/docs/api/crm#consent).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmEmailSend"
              },
              "example": {
                "email": "jane@example.com",
                "subject": "Your order shipped",
                "text": "Hi Jane,\nyour order shipped today."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sent (see `status`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmSent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CrmNotFound"
          },
          "422": {
            "$ref": "#/components/responses/CrmRefused"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/pipelines": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListPipelines",
        "tags": [
          "CRM"
        ],
        "summary": "List pipelines",
        "description": "The CRM's pipelines and their stages, in order.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The pipelines.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmPipelineList"
                },
                "example": {
                  "items": [
                    {
                      "id": "pl_2b3c4d5e6f7a8b9c0d1e",
                      "name": "Sales",
                      "stages": [
                        {
                          "id": "st_4d5e6f7a8b9c0d1e2f3a",
                          "name": "New lead",
                          "position": 0
                        },
                        {
                          "id": "st_5e6f7a8b9c0d1e2f3a4b",
                          "name": "Qualified",
                          "position": 1
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/workflows": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListWorkflows",
        "tags": [
          "CRM"
        ],
        "summary": "List workflows",
        "description": "The CRM's published workflows.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The workflows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmWorkflowList"
                },
                "example": {
                  "items": [
                    {
                      "id": "wf_0a1b2c3d4e5f6a7b8c9d",
                      "name": "New lead follow-up",
                      "status": "published"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CrmUnavailable"
          }
        }
      }
    },
    "/zapier/tags": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListTags",
        "tags": [
          "CRM"
        ],
        "summary": "List tags",
        "description": "The CRM's tags.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The tags.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmTagList"
                },
                "example": {
                  "items": [
                    {
                      "id": "tag_1a2b3c4d5e6f7a8b9c0d",
                      "name": "lead"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/team": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListTeam",
        "tags": [
          "CRM"
        ],
        "summary": "List team members",
        "description": "The team's members (in a personal CRM, just you). Their `id` is what `owner_user_id` and `assigned_to` take.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The members.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmTeamList"
                },
                "example": {
                  "items": [
                    {
                      "id": "64f1c2a9e4b0a1b2c3d4e5f6",
                      "name": "Sam Rivera",
                      "email": "you@example.com",
                      "role": "admin"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/zapier/fields": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "get": {
        "operationId": "crmListFields",
        "tags": [
          "CRM"
        ],
        "summary": "List contact custom fields",
        "description": "The contact custom fields. Their `key` is what `fields` takes.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmFieldList"
                },
                "example": {
                  "items": [
                    {
                      "key": "budget",
                      "label": "Budget",
                      "type": "number"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    },
    "/leads": {
      "servers": [
        {
          "url": "https://api.supercool.com/api/v1/crm-app",
          "description": "CRM"
        }
      ],
      "post": {
        "operationId": "crmCreateLead",
        "tags": [
          "CRM"
        ],
        "summary": "Post a lead",
        "description": "The Lead API. Creates the contact, or updates the one with the same email or phone,\nwith source `lead_api`, plus optional attribution and an opportunity. Fires the\n`form_submitted` and `lead_received` triggers. Up to 600 leads per minute per key.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CrmTeamHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrmLeadCreate"
              },
              "example": {
                "email": "jane@example.com",
                "first_name": "Jane",
                "phone": "+15555550123",
                "tags": [
                  "webinar"
                ],
                "consent": true,
                "sms_consent": true,
                "source": "pricing page",
                "attribution": {
                  "utm_source": "google",
                  "utm_campaign": "fall-promo"
                },
                "opportunity": {
                  "pipeline": "Sales",
                  "value": 50000
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The lead's contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrmLeadCreated"
                },
                "example": {
                  "ok": true,
                  "created": true,
                  "contact": {
                    "id": "ct_8f2a6c1e9b3d5f7a0c4e",
                    "email": "jane@example.com",
                    "phone": "+15555550123",
                    "first_name": "Jane",
                    "last_name": null,
                    "display_name": "Jane",
                    "tags": [
                      "tag_9f8e7d6c5b4a39281706"
                    ],
                    "fields": {},
                    "source": "lead_api",
                    "status": "active"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CrmBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/CrmUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CrmForbidden"
          },
          "422": {
            "$ref": "#/components/responses/CrmUnprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CrmTooManyRequests"
          }
        }
      }
    }
  },
  "webhooks": {
    "job-event": {
      "post": {
        "operationId": "jobEvent",
        "summary": "A job changed",
        "description": "Sent when one job (one piece of work) changes: `job.completed`, `job.failed`,\n`job.blocked`, `job.resumed` or `job.expired`. `data` is the job, with its\n`message_id` and files. Signed with the Standard Webhooks headers.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdHeader"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestampHeader"
          },
          {
            "$ref": "#/components/parameters/WebhookSignatureHeader"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobEvent"
              },
              "example": {
                "type": "job.completed",
                "timestamp": "2026-09-30T14:06:40.310000Z",
                "data": {
                  "object": "job",
                  "message_id": "msg_3f9a1c2e7b8d4e5f6a7b8c9d",
                  "job_id": "exe_9b2c4d6e8f0a1b3c5d7e9f1a2b4c6d8e",
                  "kind": "execution",
                  "role": "execution",
                  "work_id": "5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                  "title": "Candle shop vertical ad",
                  "status": "completed",
                  "reason": null,
                  "final": true,
                  "queued": null,
                  "resume_by": null,
                  "link": "https://supercool.com/chat/5d0c3e2a-8f1b-4c6d-9e7f-1a2b3c4d5e6f",
                  "started_at": "2026-09-30T14:02:11.402000Z",
                  "settled_at": "2026-09-30T14:06:40.221000Z",
                  "files": []
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds counts as delivered. Anything else is retried."
          }
        }
      }
    },
    "message-event": {
      "post": {
        "operationId": "messageEvent",
        "summary": "A message reached a status",
        "description": "Sent once each time a message reaches a status other than `processing`:\n`message.completed`, `message.partial`, `message.failed`, `message.needs_input`,\n`message.blocked` or `message.expired`. `data` is the full message, exactly as\n`GET /messages/{message_id}` returns it.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdHeader"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestampHeader"
          },
          {
            "$ref": "#/components/parameters/WebhookSignatureHeader"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds counts as delivered. Anything else is retried."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sc_key_…",
        "description": "An API key from the dashboard (https://supercool.com/dashboard#api), sent as\n`Authorization: Bearer sc_key_…`. Keys are server-side secrets.\n"
      }
    },
    "headers": {
      "Request-Id": {
        "description": "This request's id (`req_…`). Find it in the dashboard's request inspector.",
        "schema": {
          "type": "string",
          "example": "req_6c2f0e1d9a8b7c6d5e4f3a2b"
        }
      },
      "RateLimit-Limit": {
        "description": "Requests this API key may make per minute (600).",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the oldest counted request leaves the window.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "On every `429`: seconds to wait before retrying. Exact for the per-key budget; `60` for account-level limits (messages, waits, work reads).",
        "schema": {
          "type": "integer"
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Any string up to 128 characters, unique per logical request. Scoped to the API key and\nkept for 7 days: sending it again with the same body returns the same message (`200`)\nand never starts work twice; with a different body it's `409 idempotency_conflict`.\n",
        "schema": {
          "type": "string",
          "maxLength": 128
        },
        "example": "order-8812-ad"
      },
      "MessageId": {
        "name": "message_id",
        "in": "path",
        "required": true,
        "description": "The message's `id` (`msg_…`).",
        "schema": {
          "type": "string"
        },
        "example": "msg_3f9a1c2e7b8d4e5f6a7b8c9d"
      },
      "EndpointId": {
        "name": "endpoint_id",
        "in": "path",
        "required": true,
        "description": "The webhook endpoint's `id` (`whe_…`).",
        "schema": {
          "type": "string"
        },
        "example": "whe_4c1d2e3f4a5b6c7d8e9f"
      },
      "WebhookIdHeader": {
        "name": "webhook-id",
        "in": "header",
        "required": true,
        "description": "The delivery's id (`evt_…`). The same across retries of one event; use it to drop duplicates.",
        "schema": {
          "type": "string"
        }
      },
      "WebhookTimestampHeader": {
        "name": "webhook-timestamp",
        "in": "header",
        "required": true,
        "description": "Unix seconds when this attempt was signed.",
        "schema": {
          "type": "string"
        }
      },
      "WebhookSignatureHeader": {
        "name": "webhook-signature",
        "in": "header",
        "required": true,
        "description": "`v1,` + base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}`, keyed with the base64-decoded part of your `whsec_` secret.",
        "schema": {
          "type": "string"
        }
      },
      "CrmTeamHeader": {
        "name": "X-Workspace-Id",
        "in": "header",
        "required": false,
        "description": "The team id, to use that team's CRM (the key's owner must be a member). Omit it for the key owner's personal CRM. Shown on the Zapier card in the CRM's Settings → Integrations.",
        "schema": {
          "type": "string"
        }
      },
      "CrmHookId": {
        "name": "hook_id",
        "in": "path",
        "required": true,
        "description": "The subscription's `id` (`zh_…`).",
        "schema": {
          "type": "string"
        },
        "example": "zh_4c1d2e3f4a5b6c7d8e9f"
      },
      "CrmTriggerKey": {
        "name": "event",
        "in": "path",
        "required": true,
        "description": "A trigger key, such as `new_contact`. See `GET /zapier/triggers`.",
        "schema": {
          "type": "string"
        },
        "example": "new_contact"
      },
      "CrmOpportunityId": {
        "name": "opportunity_id",
        "in": "path",
        "required": true,
        "description": "The opportunity's `id` (`opp_…`).",
        "schema": {
          "type": "string"
        },
        "example": "opp_7d8e9f0a1b2c3d4e5f6a"
      },
      "CrmWorkflowId": {
        "name": "workflow_id",
        "in": "path",
        "required": true,
        "description": "The workflow's `id` (`wf_…`). See `GET /zapier/workflows`.",
        "schema": {
          "type": "string"
        },
        "example": "wf_0a1b2c3d4e5f6a7b8c9d"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request can't be processed as sent. `invalid_request` (with `problems`) when it doesn't match the schema.",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "invalid_request",
              "message": "The request doesn't match what this endpoint expects; see `problems`.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#invalid_request",
              "problems": [
                {
                  "field": "files",
                  "problem": "Input should be a valid list"
                }
              ]
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The API key is missing, unknown or revoked.",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "WWW-Authenticate": {
            "description": "Always `Bearer`.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "unauthorized",
              "message": "unknown or revoked token. Send your API key as 'Authorization: Bearer sc_key_…'.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#unauthorized"
            }
          }
        }
      },
      "NotFound": {
        "description": "Nothing with that id for this API key or account.",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "not_found",
              "message": "No message with that id for this API key.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#not_found"
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with the current state.",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "idempotency_conflict",
              "message": "That Idempotency-Key was already used for a different message. Use a new key for a new request.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#idempotency_conflict"
            }
          }
        }
      },
      "TooLarge": {
        "description": "A file or upload is over the size limit.",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "too_large",
              "message": "Files can be up to 500 MB.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#too_large"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The uploaded file was refused (an executable).",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "executable_refused",
              "message": "Executable files can't be attached.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#executable_refused"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "A rate limit was hit. Wait `Retry-After` seconds.",
        "headers": {
          "Request-Id": {
            "$ref": "#/components/headers/Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "rate_limited",
              "message": "Too many requests for this API key; slow down and retry after the Retry-After seconds.",
              "request_id": "req_6c2f0e1d9a8b7c6d5e4f3a2b",
              "docs": "https://supercool.com/docs/api/errors#rate_limited"
            }
          }
        }
      },
      "CrmBadRequest": {
        "description": "The input can't be used. `detail` says why.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmError"
            },
            "example": {
              "detail": "email or phone is required"
            }
          }
        }
      },
      "CrmUnauthorized": {
        "description": "The API key is missing, unknown, expired or revoked.",
        "headers": {
          "WWW-Authenticate": {
            "description": "Always `Bearer`.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmError"
            },
            "example": {
              "detail": "Invalid API key"
            }
          }
        }
      },
      "CrmForbidden": {
        "description": "An isolated API key, or an `X-Workspace-Id` team the key's owner isn't a member of.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmError"
            },
            "example": {
              "detail": "The key's owner is not a member of that team"
            }
          }
        }
      },
      "CrmNotFound": {
        "description": "The contact, opportunity, workflow or subscription isn't in this CRM.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmError"
            },
            "example": {
              "detail": "Contact not found"
            }
          }
        }
      },
      "CrmUnprocessable": {
        "description": "The body doesn't match the schema (a missing required field, a wrong type). `detail` lists the problems.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmValidationError"
            },
            "example": {
              "detail": [
                {
                  "type": "missing",
                  "loc": [
                    "body",
                    "target_url"
                  ],
                  "msg": "Field required",
                  "input": {
                    "event": "new_contact"
                  }
                }
              ]
            }
          }
        }
      },
      "CrmRefused": {
        "description": "The CRM's rules refused the send (`detail` is `{reason, message}`; see [refusal reasons](/docs/api/crm#refusals)), or the body doesn't match the schema (`detail` is a list).",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/CrmRefusal"
                },
                {
                  "$ref": "#/components/schemas/CrmValidationError"
                }
              ]
            },
            "example": {
              "detail": {
                "reason": "no_consent",
                "message": "Text campaigns go only to contacts with explicit SMS consent."
              }
            }
          }
        }
      },
      "CrmTooManyRequests": {
        "description": "Over the key's per-minute limit (300 on `/zapier/…`, 600 on `/leads`). Wait and retry.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmError"
            },
            "example": {
              "detail": "Too many Zapier requests per minute for this key"
            }
          }
        }
      },
      "CrmUnavailable": {
        "description": "The feature isn't available on this account yet.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CrmError"
            },
            "example": {
              "detail": "Pipelines is not available in this build yet"
            }
          }
        }
      }
    },
    "schemas": {
      "MessageCreate": {
        "type": "object",
        "description": "A message to your agent. Send `message`, files, or both.",
        "properties": {
          "message": {
            "type": "string",
            "maxLength": 20000,
            "default": "",
            "description": "What you want, in plain language. Up to 20,000 characters; send longer text as a file."
          },
          "files": {
            "type": "array",
            "description": "Small files inline (up to 5, 10 MB each, 25 MB in total). Each has a `url` or `base64`. A file that can't be fetched doesn't fail the message: it's listed in the message's `notes`.",
            "items": {
              "$ref": "#/components/schemas/InlineFile"
            }
          },
          "upload_ids": {
            "type": "array",
            "description": "Finished uploads to attach (up to 10, 1 GB in total). See `POST /uploads`.",
            "items": {
              "type": "string"
            }
          },
          "webhook_endpoint_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Send this message's webhook events to this registered endpoint (`whe_…`) instead of the account's endpoints."
          }
        }
      },
      "InlineFile": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "A file name for the agent to see."
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A public `https` URL to fetch the file from."
          },
          "base64": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file's bytes, base64-encoded."
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "The MIME type, for `base64` files."
          }
        }
      },
      "Message": {
        "type": "object",
        "description": "A message you sent and everything that came of it.",
        "required": [
          "id",
          "object",
          "status",
          "final",
          "jobs",
          "files",
          "notes",
          "credits_used",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The message id (`msg_…`), always generated by SuperCool."
          },
          "object": {
            "const": "message"
          },
          "status": {
            "$ref": "#/components/schemas/MessageStatus"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, for `blocked`, `failed`, `partial` and `expired`: `out_of_credits`, `hosting_fees`, `too_many_running`, `queue_expired`, `watch_expired`, `result_unknown`, `execution_failed`, `stopped`, `agent_busy`, `turn_failed` and others. See [Getting results](/docs/api/results#reasons)."
          },
          "question": {
            "type": [
              "string",
              "null"
            ],
            "description": "For `needs_input`, the agent's question. Answer by sending a new message."
          },
          "final": {
            "type": "boolean",
            "description": "`true` when nothing about this message will change any more. Stop polling."
          },
          "reply": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the agent said, once it has answered."
          },
          "jobs": {
            "type": "array",
            "description": "The pieces of work this message started, each with its own status.",
            "items": {
              "$ref": "#/components/schemas/Job"
            }
          },
          "files": {
            "type": "array",
            "description": "Every file the message produced (handed over in the reply, or made by its jobs).",
            "items": {
              "$ref": "#/components/schemas/File"
            }
          },
          "notes": {
            "type": "array",
            "description": "Problems with attachments (a file that couldn't be fetched, files over the limit).",
            "items": {
              "type": "string"
            }
          },
          "credits_used": {
            "type": "number",
            "description": "Credits this message's jobs used so far, in API units (hundredths of the figure the app shows; see [Units](/docs/api/credits#units))."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the agent's turn ended (or `created_at` while it's still going)."
          },
          "resume": {
            "const": "add_credits",
            "description": "Present when queued work is waiting for credits: add credits before `resume_by` and it runs by itself. Don't resend the message."
          },
          "resume_by": {
            "type": "string",
            "format": "date-time",
            "description": "The earliest deadline among queued jobs waiting for credits (24 hours after they were queued)."
          },
          "retry_after_seconds": {
            "type": "integer",
            "description": "With `reason: \"agent_busy\"`: retry with the same `Idempotency-Key` after this many seconds."
          },
          "running": {
            "type": "array",
            "description": "Present when the agent tried to start work while 5 jobs were already running on the account (a job with `reason: \"too_many_running\"`): the work running now, and the message that started each.",
            "items": {
              "type": "object",
              "properties": {
                "job_id": {
                  "type": "string",
                  "description": "`exe_…`"
                },
                "message_id": {
                  "type": "string"
                },
                "work_id": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "MessageStatus": {
        "type": "string",
        "description": "The message's status, aggregated over its jobs.",
        "enum": [
          "processing",
          "needs_input",
          "blocked",
          "completed",
          "partial",
          "failed",
          "expired"
        ]
      },
      "Job": {
        "type": "object",
        "description": "One piece of work a message started (or was refused).",
        "properties": {
          "job_id": {
            "type": "string",
            "description": "`exe_…` for work that ran or is queued; `ref_…` for work refused before it was queued."
          },
          "kind": {
            "type": "string",
            "enum": [
              "execution",
              "refusal"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "execution",
              "follow_up"
            ],
            "description": "`follow_up` when the message joined work that was already running; its status follows that work."
          },
          "work_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The chat the work runs in."
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "For `blocked`, `failed`, `cancelled` and `expired`: `out_of_credits`, `hosting_fees`, `too_many_running`, `execution_failed`, `stopped`, `queue_expired`, `watch_expired`, `result_unknown`."
          },
          "final": {
            "type": "boolean",
            "description": "`false` while running, and for queued work waiting for credits (it can still run)."
          },
          "queued": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`true` for work that is queued and waiting for credits; otherwise `null`."
          },
          "resume_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "For queued work waiting for credits, the deadline to add them (24 hours after it was queued)."
          },
          "link": {
            "type": [
              "string",
              "null"
            ],
            "description": "The work in the SuperCool app."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "settled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/File"
            }
          }
        }
      },
      "JobStatus": {
        "type": "string",
        "enum": [
          "running",
          "completed",
          "failed",
          "cancelled",
          "blocked",
          "expired"
        ]
      },
      "File": {
        "type": "object",
        "description": "A file the agent made or handed over.",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "`<work_id>/<path>`. Use it with `GET /files/{file_id}` for a fresh link."
          },
          "name": {
            "type": "string"
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "doc",
              "site"
            ]
          },
          "size": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Bytes. `null` for a site."
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A signed download link. It expires, and it is pinned to `revision`; a download answers `412` if the file changed since."
          },
          "revision": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file's version the link is pinned to. `null` for a site (its link always opens the live site)."
          },
          "work_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "FileObject": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "object": {
                "const": "file"
              }
            }
          },
          {
            "$ref": "#/components/schemas/File"
          }
        ]
      },
      "EventList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "More entries are ready; call again with `cursor` right away."
          },
          "done": {
            "type": "boolean",
            "description": "The message has nothing more to report."
          },
          "cursor": {
            "type": "string",
            "description": "Pass this back as `cursor` for the next page."
          },
          "cursor_expired": {
            "type": "boolean",
            "description": "Your cursor pointed at entries older than 7 days. `cursor` restarts from now."
          }
        }
      },
      "Event": {
        "type": "object",
        "description": "One entry in a message's update log. Fields beyond the common ones depend on `type`.",
        "properties": {
          "seq": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "enum": [
              "result",
              "progress",
              "agent_reply",
              "state",
              "turn_failed",
              "turn_busy"
            ],
            "description": "`result` (a job finished, with text and files), `progress` (a step started or a file landed), `agent_reply` (the agent's reply), `state` (`resumed`, `stopped`, `expired`, `unknown`), `turn_failed`, `turn_busy`."
          },
          "work_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The message the entry belongs to, when known."
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "job_id": {
            "type": "string",
            "description": "The job (`exe_…`) the entry belongs to, when known."
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "`result`"
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "`result`, `agent_reply`, `state`, `turn_failed`, `turn_busy`"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "completed",
              "failed",
              "stalled_credits"
            ],
            "description": "`result`"
          },
          "files": {
            "type": "array",
            "description": "`result`, `agent_reply`",
            "items": {
              "$ref": "#/components/schemas/File"
            }
          },
          "state": {
            "type": "string",
            "description": "`state`"
          },
          "step": {
            "type": [
              "string",
              "null"
            ],
            "description": "`progress`"
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "`progress`"
          },
          "file_names": {
            "type": "array",
            "description": "`progress`: names of files that just landed (download them from the `result`).",
            "items": {
              "type": "string"
            }
          },
          "delivered_sync": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`agent_reply`: `true` when this reply was already in the `POST /messages` response."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "`turn_failed`, `turn_busy`"
          }
        }
      },
      "Recovery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "recovery"
          },
          "work": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "work_id": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "settled",
                    "watching",
                    "recovering",
                    "exhausted"
                  ]
                },
                "outcome": {
                  "type": "string",
                  "description": "For `settled`, how it ended."
                }
              }
            }
          }
        }
      },
      "UploadCreate": {
        "type": "object",
        "required": [
          "filename",
          "size"
        ],
        "properties": {
          "filename": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "description": "The exact size in bytes (up to 500 MB). The upload is capped at this size."
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "The MIME type. Guessed from the file name when omitted. The POST must send the same `Content-Type` field (it is in `fields`)."
          }
        }
      },
      "UploadCreated": {
        "type": "object",
        "properties": {
          "object": {
            "const": "upload"
          },
          "upload_id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "Where to POST the file (`multipart/form-data`)."
          },
          "fields": {
            "type": "object",
            "description": "Form fields to send with the file, exactly as given.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "The presigned POST works until then (15 minutes)."
          },
          "max_bytes": {
            "type": "integer"
          }
        }
      },
      "Upload": {
        "type": "object",
        "properties": {
          "object": {
            "const": "upload"
          },
          "upload_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready"
            ]
          },
          "filename": {
            "type": "string"
          },
          "content_type": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          }
        }
      },
      "WorkList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSummary"
            }
          }
        }
      },
      "WorkSummary": {
        "type": "object",
        "properties": {
          "object": {
            "const": "work"
          },
          "work_id": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview": {
            "type": [
              "string",
              "null"
            ]
          },
          "link": {
            "type": "string"
          }
        }
      },
      "Work": {
        "type": "object",
        "properties": {
          "object": {
            "const": "work"
          },
          "work_id": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "stalled_credits",
              "idle"
            ],
            "description": "`running`, `stalled_credits` (stopped until credits are added), or `idle`."
          },
          "text": {
            "type": "string",
            "description": "The latest result text, from `from_char`."
          },
          "next_from_char": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Pass as `from_char` to read on; `null` when there's no more."
          },
          "link": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "description": "The most recent files (up to 8).",
            "items": {
              "$ref": "#/components/schemas/File"
            }
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "object": {
            "const": "account"
          },
          "user_id": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "plan": {
            "type": [
              "string",
              "null"
            ]
          },
          "credits": {
            "type": [
              "number",
              "null"
            ],
            "description": "Credits available now, in API units (hundredths of the figure the app shows; see [Units](/docs/api/credits#units))."
          },
          "agent": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              }
            }
          },
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "limits": {
            "type": "object",
            "properties": {
              "running_jobs": {
                "type": "integer",
                "description": "Running jobs allowed per account (5)."
              },
              "requests_per_minute": {
                "type": "integer",
                "description": "Requests allowed per API key per minute (600)."
              }
            }
          }
        }
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "job.completed",
          "job.failed",
          "job.blocked",
          "job.resumed",
          "job.expired",
          "message.completed",
          "message.partial",
          "message.failed",
          "message.needs_input",
          "message.blocked",
          "message.expired"
        ]
      },
      "WebhookCreate": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "A public `https` URL (port 443 or 8443, up to 2,000 characters)."
          },
          "events": {
            "type": [
              "array",
              "null"
            ],
            "description": "Events to receive, or `[\"*\"]` for all (the default).",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          }
        }
      },
      "WebhookUpdate": {
        "type": "object",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`true` turns the endpoint back on and clears its failure state; `false` turns it off."
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "object": {
            "const": "webhook_endpoint"
          },
          "id": {
            "type": "string",
            "description": "`whe_…`"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "disabled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Set when the endpoint is off (by you, or after 3 days of failed deliveries)."
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "failing_since": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When deliveries started failing. Cleared by the next success."
          }
        }
      },
      "WebhookEndpointWithSecret": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookEndpoint"
          },
          {
            "type": "object",
            "properties": {
              "secret": {
                "type": "string",
                "description": "The signing secret (`whsec_…`). Shown only in this response."
              }
            }
          }
        ]
      },
      "WebhookEndpointDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookEndpoint"
          },
          {
            "type": "object",
            "properties": {
              "recent_deliveries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          }
        ]
      },
      "WebhookEndpointList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpoint"
            }
          }
        }
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "object": {
            "const": "webhook_delivery"
          },
          "id": {
            "type": "string",
            "description": "The delivery id (`evt_…`), sent as `webhook-id`."
          },
          "event": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "delivered",
              "cancelled",
              "dead"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "last_status_code": {
            "type": [
              "integer",
              "null"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_response": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first 4 KB of your endpoint's last response."
          },
          "last_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RotatedSecret": {
        "type": "object",
        "properties": {
          "object": {
            "const": "webhook_endpoint"
          },
          "id": {
            "type": "string"
          },
          "secret": {
            "type": "string"
          }
        }
      },
      "Deleted": {
        "type": "object",
        "properties": {
          "object": {
            "const": "webhook_endpoint"
          },
          "id": {
            "type": "string"
          },
          "deleted": {
            "const": true
          }
        }
      },
      "JobEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "job.completed",
              "job.failed",
              "job.blocked",
              "job.resumed",
              "job.expired"
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "object": {
                    "const": "job"
                  },
                  "message_id": {
                    "type": "string"
                  }
                }
              },
              {
                "$ref": "#/components/schemas/Job"
              }
            ]
          }
        }
      },
      "MessageEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "message.completed",
              "message.partial",
              "message.failed",
              "message.needs_input",
              "message.blocked",
              "message.expired"
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "$ref": "#/components/schemas/Message"
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Every API error has this shape.",
        "required": [
          "error",
          "message",
          "request_id",
          "docs"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "type": "string",
            "description": "What went wrong, for people."
          },
          "request_id": {
            "type": "string",
            "description": "The request's id (`req_…`), also in the `Request-Id` header."
          },
          "docs": {
            "type": "string",
            "description": "A link to this error code's documentation."
          },
          "problems": {
            "type": "array",
            "description": "With `invalid_request`: what doesn't match, one entry per problem (up to 10).",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The dotted location of the field (like `files.0.url` or `wait`), or `null` for the body as a whole."
                },
                "problem": {
                  "type": "string"
                }
              }
            }
          },
          "cursor": {
            "type": "string",
            "description": "With `poll_in_progress`: the cursor to use when you call again."
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "description": "A stable, machine-readable error code. Each one is documented at `https://supercool.com/docs/api/errors#<code>`.",
        "enum": [
          "bad_request",
          "invalid_request",
          "empty_message",
          "too_long",
          "bad_cursor",
          "bad_url",
          "bad_events",
          "bad_size",
          "too_many",
          "unauthorized",
          "not_found",
          "idempotency_conflict",
          "poll_in_progress",
          "too_many_endpoints",
          "not_pending",
          "not_uploaded",
          "changed",
          "upload_not_ready",
          "too_large",
          "executable_refused",
          "rate_limited",
          "internal",
          "unavailable"
        ],
        "x-http-status": {
          "bad_request": 400,
          "invalid_request": 400,
          "empty_message": 400,
          "too_long": 400,
          "bad_cursor": 400,
          "bad_url": 400,
          "bad_events": 400,
          "bad_size": 400,
          "too_many": 400,
          "unauthorized": 401,
          "not_found": 404,
          "idempotency_conflict": 409,
          "poll_in_progress": 409,
          "too_many_endpoints": 409,
          "not_pending": 409,
          "not_uploaded": 409,
          "changed": 409,
          "upload_not_ready": 409,
          "too_large": 413,
          "executable_refused": 422,
          "rate_limited": 429,
          "internal": 500,
          "unavailable": 503
        }
      },
      "CrmError": {
        "type": "object",
        "description": "A CRM API error: FastAPI's `{\"detail\": …}`.",
        "required": [
          "detail"
        ],
        "properties": {
          "detail": {
            "type": "string",
            "description": "What went wrong, for people."
          }
        }
      },
      "CrmValidationError": {
        "type": "object",
        "description": "A body that doesn't match the endpoint's schema (`422`).",
        "required": [
          "detail"
        ],
        "properties": {
          "detail": {
            "type": "array",
            "description": "One entry per problem.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "The kind of problem, like `missing`."
                },
                "loc": {
                  "type": "array",
                  "description": "Where, like `[\"body\", \"title\"]`.",
                  "items": {
                    "type": [
                      "string",
                      "integer"
                    ]
                  }
                },
                "msg": {
                  "type": "string",
                  "description": "The problem, for people."
                },
                "input": {
                  "description": "The value that was sent."
                }
              }
            }
          }
        }
      },
      "CrmRefusal": {
        "type": "object",
        "description": "A text or email the CRM's rules refused (`422`). Nothing was sent or queued.",
        "required": [
          "detail"
        ],
        "properties": {
          "detail": {
            "type": "object",
            "required": [
              "reason",
              "message"
            ],
            "properties": {
              "reason": {
                "type": "string",
                "description": "Machine-readable: `no_consent`, `dnd`, `suppressed_owner`, `suppressed_global`, `paused`, `cap`, `credits`, `no_phone`, `landline`, `quiet_hours`, `no_number`, `unregistered`, `suspended`, `releasing`, `unpaid`, `kill_switch`, `too_long`, `media`, `no_email`, `no_channel`, `unsubscribed`, `bounced`. See [refusal reasons](/docs/api/crm#refusals)."
              },
              "message": {
                "type": "string",
                "description": "What happened, for people."
              }
            }
          }
        }
      },
      "CrmOk": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "const": true
          }
        }
      },
      "CrmAccount": {
        "type": "object",
        "description": "An API key, its owner, and the CRM it reaches.",
        "required": [
          "ok",
          "user_id",
          "workspace_id",
          "role",
          "key",
          "label"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "user_id": {
            "type": "string",
            "description": "The key owner's user id."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The key owner's email address."
          },
          "workspace_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The team id, or `null` for the owner's personal CRM."
          },
          "team_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The team's name, or `null` for a personal CRM."
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ],
            "description": "The key owner's role in this CRM."
          },
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The key's id."
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The key's nickname."
              },
              "hint": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its first and last characters, like `sc_key_9fK2…x7Qa`."
              }
            }
          },
          "label": {
            "type": "string",
            "description": "A name for the connection, like `you@example.com · Rivera Studio`."
          }
        }
      },
      "CrmTrigger": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The trigger key to subscribe with, like `new_contact`."
          },
          "label": {
            "type": "string",
            "description": "Its name, like `New Contact`."
          },
          "noun": {
            "type": "string",
            "description": "What it's about, like `Contact`."
          },
          "types": {
            "type": "array",
            "description": "The CRM event types it fires on, like `contact.created`.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CrmTriggerList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrmTrigger"
            }
          }
        }
      },
      "CrmHookCreate": {
        "type": "object",
        "required": [
          "event",
          "target_url"
        ],
        "properties": {
          "event": {
            "type": "string",
            "description": "A trigger key (`GET /zapier/triggers`), like `new_contact`."
          },
          "target_url": {
            "type": "string",
            "maxLength": 2048,
            "description": "A public `http` or `https` URL. Private and local addresses are refused."
          }
        }
      },
      "CrmHookDelete": {
        "type": "object",
        "description": "Send `id`, or `target_url` (optionally with `event`).",
        "properties": {
          "id": {
            "type": "string",
            "description": "The subscription's id (`zh_…`)."
          },
          "target_url": {
            "type": "string",
            "description": "Remove every subscription to this URL."
          },
          "event": {
            "type": "string",
            "description": "With `target_url`, only the subscription for this trigger."
          }
        }
      },
      "CrmHook": {
        "type": "object",
        "description": "A REST hook subscription. It belongs to the CRM, not to the key.",
        "properties": {
          "id": {
            "type": "string",
            "description": "`zh_…`"
          },
          "key_id": {
            "type": "string",
            "description": "The API key that created it. If that key is revoked, the subscription is removed at its next event."
          },
          "event": {
            "type": "string",
            "description": "The trigger key."
          },
          "label": {
            "type": "string",
            "description": "The trigger's name."
          },
          "target_url": {
            "type": "string"
          },
          "target_host": {
            "type": [
              "string",
              "null"
            ]
          },
          "key_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The creating key's nickname."
          },
          "key_hint": {
            "type": [
              "string",
              "null"
            ],
            "description": "The creating key's first and last characters."
          },
          "deliveries": {
            "type": "integer",
            "description": "Events delivered."
          },
          "failures": {
            "type": "integer",
            "description": "Events that failed for good."
          },
          "last_delivery_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_status": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The HTTP status of the latest attempt."
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "The latest attempt's error, if it failed."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CrmHookList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrmHook"
            }
          }
        }
      },
      "CrmEvent": {
        "type": "object",
        "description": "What a REST hook receives, and what `GET /zapier/perform-list/{event}` returns: one CRM event and its contact. POSTed with `X-SuperCool-Event` and `X-SuperCool-Delivery` headers; see [Delivery](/docs/api/crm#delivery).",
        "properties": {
          "id": {
            "type": "string",
            "description": "The event id (`ev_…`). The same on every retry; use it to drop duplicates."
          },
          "trigger": {
            "type": "string",
            "description": "The trigger key the subscription is for."
          },
          "type": {
            "type": "string",
            "description": "The CRM event type, like `contact.created`."
          },
          "label": {
            "type": "string",
            "description": "The event type's name, like `Contact created`."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "contact_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "object",
              "null"
            ],
            "description": "The contact, flattened for field mapping.",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "first_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "full_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "company": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "postal_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "owner_user_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fields": {
                "type": "object",
                "description": "Custom field values by key."
              },
              "tag_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "tags": {
                "type": "array",
                "description": "Tag names.",
                "items": {
                  "type": "string"
                }
              },
              "dnd": {
                "type": "object",
                "description": "`email`, `sms`, `calls`, `all` (booleans), `reason`, `at`."
              },
              "consent": {
                "type": "object",
                "description": "`email` and `sms`: each consent status, like `explicit`, or `null`."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "data": {
            "type": "object",
            "description": "What happened. The fields depend on the trigger; see the [trigger catalogue](/docs/api/crm#trigger-catalogue)."
          },
          "ref": {
            "type": "object",
            "description": "Ids of related records, like `opportunity_id`, `appointment_id`, `task_id` or `form_id`."
          },
          "actor": {
            "type": "object",
            "description": "Who did it: `kind` (`user`, `api_key`, `webhook` or `system`) and `id`."
          }
        }
      },
      "CrmEventList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrmEvent"
            }
          }
        }
      },
      "CrmContactLookup": {
        "type": "object",
        "description": "Names an existing contact: by `contact_id` (or `contact`) as an id, then as an email address or phone number, then by `email`, then by `phone`. No match is `404 Contact not found`.",
        "properties": {
          "contact_id": {
            "type": "string",
            "description": "The contact's id (`ct_…`)."
          },
          "contact": {
            "type": "string",
            "description": "An id, email address or phone number."
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          }
        }
      },
      "CrmTags": {
        "description": "Tag names, as a list or one comma-separated string (up to 50, 80 characters each).",
        "oneOf": [
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "string"
          }
        ]
      },
      "CrmContactWrite": {
        "type": "object",
        "description": "A contact's fields. For create or update, `email` or `phone` is required and finds the contact. For update, `contact_id` or `contact` (or `email` / `phone`) finds it.",
        "properties": {
          "contact_id": {
            "type": "string",
            "description": "Update only. The contact's id."
          },
          "contact": {
            "type": "string",
            "description": "Update only. An id, email address or phone number."
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "description": "Stored in E.164. US numbers without a country code get `+1`."
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "owner_user_id": {
            "type": "string",
            "description": "A team member's user id (`GET /zapier/team`)."
          },
          "tags": {
            "$ref": "#/components/schemas/CrmTags"
          },
          "fields": {
            "type": "object",
            "description": "Custom field values by key (`GET /zapier/fields`). Create or update ignores unknown keys; update refuses them."
          },
          "consent": {
            "type": "boolean",
            "description": "Create or update only. `true` records explicit email consent. Otherwise email consent is `imported_unknown`, unless already explicit."
          },
          "sms_consent": {
            "type": "boolean",
            "description": "Create or update only. `true` records explicit SMS consent, if the contact has a phone number."
          }
        }
      },
      "CrmContact": {
        "type": "object",
        "description": "A CRM contact. Other fields may be present, like `attribution`.",
        "properties": {
          "id": {
            "type": "string",
            "description": "`ct_…`"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "E.164."
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": "string",
            "description": "The full name, else the email, else the phone."
          },
          "tags": {
            "type": "array",
            "description": "Tag ids (`tag_…`).",
            "items": {
              "type": "string"
            }
          },
          "fields": {
            "type": "object",
            "description": "Custom field values by key."
          },
          "source": {
            "type": "string",
            "description": "Where it came from, like `zapier`, `lead_api`, `form`, `import` or `manual`."
          },
          "owner_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "unsubscribed",
              "bounced",
              "blocked"
            ]
          },
          "dnd": {
            "type": "object",
            "description": "Do Not Disturb: `email`, `sms`, `calls`, `all` (booleans), `reason`, `at`."
          },
          "consent": {
            "type": "object",
            "description": "`email` and `call`, each `{status, source, at}`. Send Email needs email consent `explicit`."
          },
          "last_activity_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CrmContactResult": {
        "description": "The contact's fields at the top level, plus `ok` (and `created` from create or update).",
        "allOf": [
          {
            "type": "object",
            "properties": {
              "ok": {
                "const": true
              },
              "created": {
                "type": "boolean",
                "description": "Create or update only. `true` if the contact is new."
              }
            }
          },
          {
            "$ref": "#/components/schemas/CrmContact"
          }
        ]
      },
      "CrmContactList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "description": "The contact, or empty.",
            "items": {
              "$ref": "#/components/schemas/CrmContact"
            }
          }
        }
      },
      "CrmTagsChange": {
        "description": "A contact (see `CrmContactLookup`) and the tags to add or remove.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CrmContactLookup"
          },
          {
            "type": "object",
            "required": [
              "tags"
            ],
            "properties": {
              "tags": {
                "$ref": "#/components/schemas/CrmTags"
              }
            }
          }
        ]
      },
      "CrmOpportunityCreate": {
        "description": "A contact (see `CrmContactLookup`) and the opportunity.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CrmContactLookup"
          },
          {
            "type": "object",
            "properties": {
              "pipeline_id": {
                "type": "string",
                "description": "The pipeline's id (`pl_…`). With neither this nor `pipeline`, the default pipeline."
              },
              "pipeline": {
                "type": "string",
                "description": "The pipeline's id or name."
              },
              "stage_id": {
                "type": "string",
                "description": "The stage's id (`st_…`) or name. With neither this nor `stage`, the first stage."
              },
              "stage": {
                "type": "string",
                "description": "The stage's id or name (any case)."
              },
              "name": {
                "type": "string",
                "description": "Defaults to the contact's name."
              },
              "value": {
                "description": "A number is in minor units (`150000` is 1,500.00); a string is in major units (`\"1,500.00\"`).",
                "oneOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "currency": {
                "type": "string",
                "description": "A 3-letter code. Defaults to the CRM's currency."
              },
              "owner_user_id": {
                "type": "string",
                "description": "A team member's user id. Ignored if they're not on the team."
              },
              "tags": {
                "$ref": "#/components/schemas/CrmTags"
              },
              "fields": {
                "type": "object",
                "description": "Opportunity custom field values by key."
              },
              "expected_close_at": {
                "type": "string",
                "description": "`YYYY-MM-DD`."
              },
              "allow_duplicate": {
                "type": "boolean",
                "description": "Allow a second open opportunity for the contact in this pipeline."
              }
            }
          }
        ]
      },
      "CrmOpportunityMove": {
        "type": "object",
        "description": "At least one of a stage, a pipeline or a status.",
        "properties": {
          "stage_id": {
            "type": "string",
            "description": "The new stage's id or name."
          },
          "stage": {
            "type": "string",
            "description": "The new stage's id or name (any case)."
          },
          "pipeline_id": {
            "type": "string",
            "description": "Move to this pipeline (its first stage unless a stage is given)."
          },
          "pipeline": {
            "type": "string",
            "description": "The pipeline's id or name."
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "won",
              "lost",
              "abandoned"
            ]
          },
          "lost_reason": {
            "type": "string",
            "description": "With `status` `lost`."
          }
        }
      },
      "CrmOpportunity": {
        "type": "object",
        "description": "A potential sale on one contact, in one stage of one pipeline. Other fields are included too, like `followers`, `stage_entered_at` and `days_in_stage`.",
        "properties": {
          "id": {
            "type": "string",
            "description": "`opp_…`"
          },
          "pipeline_id": {
            "type": "string"
          },
          "stage_id": {
            "type": "string"
          },
          "contact_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "won",
              "lost",
              "abandoned"
            ]
          },
          "value": {
            "type": "integer",
            "description": "In minor units (cents)."
          },
          "currency": {
            "type": "string",
            "description": "Lower-case 3-letter code."
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "description": "Tag ids.",
            "items": {
              "type": "string"
            }
          },
          "fields": {
            "type": "object"
          },
          "lost_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "expected_close_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CrmTaskCreate": {
        "description": "The task, and optionally its contact (see `CrmContactLookup`).",
        "allOf": [
          {
            "$ref": "#/components/schemas/CrmContactLookup"
          },
          {
            "type": "object",
            "required": [
              "title"
            ],
            "properties": {
              "title": {
                "type": "string",
                "description": "Longer titles are cut to 200 characters."
              },
              "description": {
                "type": "string"
              },
              "opportunity_id": {
                "type": "string"
              },
              "assigned_to": {
                "type": "string",
                "description": "A team member's user id."
              },
              "due_at": {
                "type": "string",
                "format": "date-time",
                "description": "An exact time. Wins over `due_date`."
              },
              "due_date": {
                "type": "string",
                "description": "`YYYY-MM-DD`. Without `due_time`, due all day."
              },
              "due_time": {
                "type": "string",
                "description": "`HH:MM`."
              },
              "timezone": {
                "type": "string",
                "description": "The IANA zone of `due_date` and `due_time`. Defaults to the assignee's zone, else the CRM's, else UTC."
              }
            }
          }
        ]
      },
      "CrmTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`tsk_…`"
          },
          "title": {
            "type": "string"
          },
          "description_html": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "opportunity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "assigned_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "all_day": {
            "type": "boolean"
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "description": "`open` for a new task."
          },
          "origin": {
            "type": "object",
            "description": "`{\"kind\": \"manual\", \"reason\": \"Created by Zapier\"}` for tasks this API creates."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CrmEnrollment": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "`true` if the contact was enrolled."
          },
          "reason": {
            "type": "string",
            "enum": [
              "enrolled",
              "already_active",
              "no_reentry",
              "not_published"
            ]
          },
          "enrollment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "`wfe_…`, when enrolled."
          },
          "workflow_id": {
            "type": "string"
          },
          "workflow_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_id": {
            "type": "string"
          }
        }
      },
      "CrmTextSend": {
        "description": "A contact (see `CrmContactLookup`) and the text.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CrmContactLookup"
          },
          {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "description": "Required (or `message`). Cut at 1,600 characters; over 10 segments with the opt-out footer is refused (`too_long`)."
              },
              "message": {
                "type": "string",
                "description": "Same as `text`."
              },
              "media": {
                "type": "array",
                "description": "One image file already stored in SuperCool (its storage key), up to 1 MB, for MMS. Anything else is refused (`media`).",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        ]
      },
      "CrmEmailSend": {
        "description": "A contact (see `CrmContactLookup`) and the email.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CrmContactLookup"
          },
          {
            "type": "object",
            "properties": {
              "subject": {
                "type": "string",
                "description": "Required. Cut at 300 characters."
              },
              "html": {
                "type": "string",
                "description": "The HTML body. `html`, `body` or `text` is required."
              },
              "body": {
                "type": "string",
                "description": "Same as `html`."
              },
              "text": {
                "type": "string",
                "description": "A plain-text body. Without `html`, it also becomes the HTML body."
              }
            }
          }
        ]
      },
      "CrmSent": {
        "type": "object",
        "description": "A text or email that was sent, or handed to the carrier or provider.",
        "properties": {
          "ok": {
            "const": true
          },
          "contact_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "The message id (`cmsg_…`)."
          },
          "status": {
            "type": "string",
            "description": "`accepted`, `uncertain` or `failed`; a text can also be `refused` (the carrier says the number opted out)."
          },
          "kind": {
            "type": "string",
            "description": "`sms` or `email`."
          },
          "conversation_id": {
            "type": "string"
          },
          "segments": {
            "type": "integer",
            "description": "Texts only."
          },
          "credits": {
            "type": "integer",
            "description": "What the send cost."
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CrmPipelineList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "`pl_…`"
                },
                "name": {
                  "type": "string"
                },
                "stages": {
                  "type": "array",
                  "description": "In order.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "`st_…`"
                      },
                      "name": {
                        "type": "string"
                      },
                      "position": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "CrmWorkflowList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "description": "Published workflows.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "`wf_…`"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "CrmTagList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "`tag_…`"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "CrmTeamList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The member's user id."
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "admin",
                    "member"
                  ]
                }
              }
            }
          }
        }
      },
      "CrmFieldList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "What `fields` takes."
                },
                "label": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "number",
                    "date",
                    "select",
                    "multiselect",
                    "checkbox",
                    "url"
                  ]
                }
              }
            }
          }
        }
      },
      "CrmLeadCreate": {
        "type": "object",
        "description": "A lead. `email` or `phone` is required.",
        "properties": {
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "description": "Tag names to add (up to 50). Missing tags are created.",
            "items": {
              "type": "string"
            }
          },
          "fields": {
            "type": "object",
            "description": "Custom field values by key. Unknown keys are ignored."
          },
          "consent": {
            "type": "boolean",
            "description": "`true` records explicit email consent. Otherwise `imported_unknown`, unless already explicit."
          },
          "sms_consent": {
            "type": "boolean",
            "description": "`true` records explicit SMS consent, if the lead has a phone number."
          },
          "source": {
            "type": "string",
            "description": "Your label for where the lead came from. Kept as `lead_source`."
          },
          "attribution": {
            "type": "object",
            "description": "`utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`, `gclid`, `fbclid`, `referrer`, `landing_url`. The first becomes the contact's first touch; each updates the last touch."
          },
          "opportunity": {
            "type": "object",
            "description": "Add the lead to a pipeline: `pipeline_id` or `pipeline` (name), `stage_id`, `value` (minor units if a number, major if a string), `name`. If it can't be created, the lead is still saved."
          },
          "workspace_id": {
            "type": "string",
            "description": "The team id, if you don't send `X-Workspace-Id`."
          }
        }
      },
      "CrmLeadCreated": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "created": {
            "type": "boolean",
            "description": "`true` if the contact is new."
          },
          "contact": {
            "$ref": "#/components/schemas/CrmContact"
          }
        }
      }
    }
  }
}
