{
    "openapi": "3.1.0",
    "info": {
        "title": "Cubrel REST API",
        "version": "1",
        "description": "Read and write Cubrel records. Every request needs an API token, created by an admin under Workspace > Integrations > API Tokens."
    },
    "servers": [
        {
            "url": "https://{workspace}.cubrel.com/api/v1",
            "variables": {
                "workspace": {
                    "default": "yourcompany",
                    "description": "Your workspace's subdomain."
                }
            }
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "paths": {
        "/{module}": {
            "get": {
                "tags": [
                    "Any module"
                ],
                "operationId": "listRecords",
                "summary": "List records",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 25
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 1
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Matches the module's searchable fields."
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "A sortable field."
                    },
                    {
                        "name": "direction",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ],
                            "default": "asc"
                        }
                    },
                    {
                        "name": "filter",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "The slug or id of a saved list filter."
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "200": {
                        "description": "One page of records.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Record"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/ListMeta"
                                        },
                                        "links": {
                                            "$ref": "#/components/schemas/ListLinks"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Any module"
                ],
                "operationId": "createRecord",
                "summary": "Create a record",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/RecordInput"
                            }
                        }
                    }
                },
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "201": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Record"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "Any module"
                ],
                "operationId": "upsertRecord",
                "summary": "Create or update by a matching field",
                "description": "Updates the one record whose `match` field has the value sent in the body, or creates a record when none has it. More than one match is a 422.",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "match",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "A writable text or email field, such as `sku` or `email`."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/RecordInput"
                            }
                        }
                    }
                },
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "200": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Record"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Record"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/{module}/{id}": {
            "get": {
                "tags": [
                    "Any module"
                ],
                "operationId": "getRecord",
                "summary": "Get a record",
                "description": "Includes `related` records, and `line_items` on quotes and orders, `attendees` on meetings.",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "200": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Record"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Any module"
                ],
                "operationId": "updateRecord",
                "summary": "Update a record",
                "description": "Only the fields you send change. `line_items` or `attendees`, when sent, is the complete new list. PUT does the same.",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/RecordInput"
                            }
                        }
                    }
                },
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "200": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Record"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Any module"
                ],
                "operationId": "deleteRecord",
                "summary": "Delete a record",
                "description": "Moves the record to the Bin.",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "204": {
                        "description": "Deleted."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/{module}/relationships": {
            "get": {
                "tags": [
                    "Any module"
                ],
                "operationId": "listRecordRelationships",
                "summary": "List the module's relationships",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "200": {
                        "description": "The relationships records of this module can be linked through."
                    }
                }
            }
        },
        "/{module}/{id}/relationships/{relationship}": {
            "post": {
                "tags": [
                    "Any module"
                ],
                "operationId": "linkRecord",
                "summary": "Link records",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "relationship",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "related_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "uuid"
                                        },
                                        "maxItems": 500
                                    }
                                },
                                "required": [
                                    "related_ids"
                                ]
                            }
                        }
                    }
                },
                "description": "A link that exists, or that the relationship's type doesn't allow, is a 422.",
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "201": {
                        "description": "The linked records."
                    }
                }
            }
        },
        "/{module}/{id}/relationships/{relationship}/{relatedId}": {
            "delete": {
                "tags": [
                    "Any module"
                ],
                "operationId": "unlinkRecord",
                "summary": "Unlink a record",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The module's slug, as in its URL in the app, such as `contacts`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "relationship",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "relatedId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "204": {
                        "description": "Unlinked."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/contacts": {
            "get": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "listContactss",
                "summary": "List records",
                "parameters": [
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 25
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 1
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Matches the module's searchable fields."
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "A sortable field."
                    },
                    {
                        "name": "direction",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ],
                            "default": "asc"
                        }
                    },
                    {
                        "name": "filter",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "The slug or id of a saved list filter."
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "200": {
                        "description": "One page of records.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Contacts"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/ListMeta"
                                        },
                                        "links": {
                                            "$ref": "#/components/schemas/ListLinks"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "createContacts",
                "summary": "Create a record",
                "parameters": [],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContactsInput"
                            }
                        }
                    }
                },
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "201": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Contacts"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "upsertContacts",
                "summary": "Create or update by a matching field",
                "description": "Updates the one record whose `match` field has the value sent in the body, or creates a record when none has it. More than one match is a 422.",
                "parameters": [
                    {
                        "name": "match",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "A writable text or email field, such as `sku` or `email`."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContactsInput"
                            }
                        }
                    }
                },
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "200": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Contacts"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Contacts"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/contacts/{id}": {
            "get": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "getContacts",
                "summary": "Get a record",
                "description": "Includes `related` records, and `line_items` on quotes and orders, `attendees` on meetings.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "200": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Contacts"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "updateContacts",
                "summary": "Update a record",
                "description": "Only the fields you send change. `line_items` or `attendees`, when sent, is the complete new list. PUT does the same.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContactsInput"
                            }
                        }
                    }
                },
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "200": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Contacts"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "deleteContacts",
                "summary": "Delete a record",
                "description": "Moves the record to the Bin.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "204": {
                        "description": "Deleted."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/contacts/relationships": {
            "get": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "listContactsRelationships",
                "summary": "List the module's relationships",
                "parameters": [],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "200": {
                        "description": "The relationships records of this module can be linked through."
                    }
                }
            }
        },
        "/contacts/{id}/relationships/{relationship}": {
            "post": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "linkContacts",
                "summary": "Link records",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "relationship",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "related_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "uuid"
                                        },
                                        "maxItems": 500
                                    }
                                },
                                "required": [
                                    "related_ids"
                                ]
                            }
                        }
                    }
                },
                "description": "A link that exists, or that the relationship's type doesn't allow, is a 422.",
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "3": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "4": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "201": {
                        "description": "The linked records."
                    }
                }
            }
        },
        "/contacts/{id}/relationships/{relationship}/{relatedId}": {
            "delete": {
                "tags": [
                    "Example: Contacts"
                ],
                "operationId": "unlinkContacts",
                "summary": "Unlink a record",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "relationship",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "relatedId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "0": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "1": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "2": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "204": {
                        "description": "Unlinked."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/tickets/{module}": {
            "post": {
                "tags": [
                    "Tickets"
                ],
                "operationId": "openTicket",
                "summary": "Open a ticket",
                "description": "Opens a ticket with its first message, sent by the requester.",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "A ticket module's slug, such as `cases`."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "requester_email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "requester_name": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "subject": {
                                        "type": "string",
                                        "maxLength": 250
                                    },
                                    "body": {
                                        "type": "string",
                                        "maxLength": 65000
                                    }
                                },
                                "required": [
                                    "requester_email",
                                    "subject",
                                    "body"
                                ],
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The record.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Record"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationFailed"
                    }
                }
            }
        },
        "/tickets/{module}/{id}/messages": {
            "post": {
                "tags": [
                    "Tickets"
                ],
                "operationId": "replyToTicket",
                "summary": "Add a message to a ticket",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "A ticket module's slug, such as `cases`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "body": {
                                        "type": "string",
                                        "maxLength": 65000
                                    },
                                    "author": {
                                        "type": "string",
                                        "enum": [
                                            "customer",
                                            "agent"
                                        ]
                                    },
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    }
                                },
                                "required": [
                                    "body"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new message."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationFailed"
                    }
                }
            },
            "get": {
                "tags": [
                    "Tickets"
                ],
                "operationId": "listTicketMessages",
                "summary": "List a ticket's messages",
                "description": "The conversation without internal notes.",
                "parameters": [
                    {
                        "name": "module",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "A ticket module's slug, such as `cases`."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The ticket's messages, oldest first."
                    }
                }
            }
        }
    },
    "webhooks": {
        "{module}.created": {
            "post": {
                "summary": "{module}.created",
                "description": "Sent to a webhook's URL, signed in the X-Cubrel-Signature header (t=<timestamp>,v1=<HMAC SHA-256 of \"<t>.<body>\">).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Any 2xx counts as delivered."
                    }
                }
            }
        },
        "{module}.updated": {
            "post": {
                "summary": "{module}.updated",
                "description": "Sent to a webhook's URL, signed in the X-Cubrel-Signature header (t=<timestamp>,v1=<HMAC SHA-256 of \"<t>.<body>\">).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Any 2xx counts as delivered."
                    }
                }
            }
        },
        "{module}.deleted": {
            "post": {
                "summary": "{module}.deleted",
                "description": "Sent to a webhook's URL, signed in the X-Cubrel-Signature header (t=<timestamp>,v1=<HMAC SHA-256 of \"<t>.<body>\">).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Any 2xx counts as delivered."
                    }
                }
            }
        },
        "{module}.message_created": {
            "post": {
                "summary": "{module}.message_created",
                "description": "Sent to a webhook's URL, signed in the X-Cubrel-Signature header (t=<timestamp>,v1=<HMAC SHA-256 of \"<t>.<body>\">).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Any 2xx counts as delivered."
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    }
                }
            },
            "ValidationError": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "ListMeta": {
                "type": "object",
                "properties": {
                    "total": {
                        "type": "integer"
                    },
                    "per_page": {
                        "type": "integer"
                    },
                    "current_page": {
                        "type": "integer"
                    },
                    "last_page": {
                        "type": "integer"
                    }
                }
            },
            "ListLinks": {
                "type": "object",
                "properties": {
                    "next": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "prev": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "LineItemInput": {
                "type": "object",
                "description": "Name the product by `sku` or `product_id`; its name, price, unit and tax rate fill what you leave out. Without a product, `name`, `quantity` and `unit_price` are required. With `id`, an existing item is updated.",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "sku": {
                        "type": "string"
                    },
                    "product_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "description": {
                        "type": "string"
                    },
                    "unit": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "unit_price": {
                        "type": "number",
                        "minimum": 0
                    },
                    "quantity": {
                        "type": "number",
                        "minimum": 0
                    },
                    "discount": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100,
                        "description": "Percent."
                    },
                    "tax_rate": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Percent."
                    },
                    "note": {
                        "type": "string",
                        "maxLength": 1000
                    }
                },
                "additionalProperties": false
            },
            "LineItem": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "product_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "name": {
                        "type": "string"
                    },
                    "quantity": {
                        "type": "string"
                    },
                    "unit_price": {
                        "type": "string"
                    },
                    "subtotal": {
                        "type": "string"
                    },
                    "discount_amount": {
                        "type": "string"
                    },
                    "tax_amount": {
                        "type": "string"
                    },
                    "total": {
                        "type": "string"
                    }
                },
                "additionalProperties": true
            },
            "AttendeeInput": {
                "type": "object",
                "description": "By `email`: matched to a user, then a contact, then a lead; no single match adds a guest. Or by `source_type` and `source_id`, or `id` for one already on the meeting.",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "name": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "source_type": {
                        "type": "string",
                        "enum": [
                            "contact",
                            "lead",
                            "user"
                        ]
                    },
                    "source_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "organizer",
                            "required",
                            "optional"
                        ]
                    },
                    "rsvp_status": {
                        "type": "string",
                        "enum": [
                            "invited",
                            "accepted",
                            "declined",
                            "tentative"
                        ]
                    },
                    "attendance_status": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "attended",
                            "no_show",
                            null
                        ]
                    }
                },
                "additionalProperties": false
            },
            "Attendee": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "source_type": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "source_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "organizer",
                            "required",
                            "optional"
                        ]
                    },
                    "rsvp_status": {
                        "type": "string"
                    },
                    "attendance_status": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "additionalProperties": true
            },
            "WebhookEvent": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Unique per delivery; skip an id you have seen."
                    },
                    "event": {
                        "type": "string"
                    },
                    "occurred_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "data": {
                        "type": "object",
                        "description": "The record's fields as GET returns them, with line_items on quotes and orders; only the id on deleted."
                    },
                    "changes": {
                        "type": "object",
                        "description": "On updated: each changed field with from and to.",
                        "additionalProperties": {
                            "type": "object",
                            "properties": {
                                "from": [],
                                "to": []
                            }
                        }
                    }
                }
            },
            "Contacts": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "readOnly": true
                    },
                    "name": {
                        "type": "string",
                        "description": "Name"
                    },
                    "description": {
                        "type": "string",
                        "description": "Description"
                    },
                    "owner_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owned by. The id of a record in users."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Created At",
                        "readOnly": true
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Updated At",
                        "readOnly": true
                    },
                    "created_by": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Created By. The id of a record in users.",
                        "readOnly": true
                    },
                    "updated_by": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Updated By. The id of a record in users.",
                        "readOnly": true
                    },
                    "first_name": {
                        "type": "string",
                        "description": "First Name"
                    },
                    "last_name": {
                        "type": "string",
                        "description": "Last Name"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "description": "Email"
                    },
                    "phone": {
                        "type": "string",
                        "description": "Phone"
                    },
                    "position": {
                        "type": "string",
                        "description": "Position"
                    },
                    "notes": {
                        "type": "string",
                        "description": "Notes"
                    },
                    "avatar": {
                        "type": "string",
                        "description": "Profile Picture"
                    },
                    "address": {
                        "type": "object",
                        "description": "Address"
                    },
                    "mobile": {
                        "type": "string",
                        "description": "Mobile"
                    },
                    "salutation": {
                        "type": "string",
                        "enum": [
                            "mr",
                            "ms",
                            "mx",
                            "dr",
                            "prof"
                        ],
                        "description": "Salutation"
                    },
                    "department": {
                        "type": "string",
                        "description": "Department"
                    },
                    "marketing_consent": {
                        "type": "boolean",
                        "description": "Marketing Consent"
                    },
                    "consent_date": {
                        "type": "string",
                        "format": "date",
                        "description": "Consent Date"
                    },
                    "related": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "object"
                            }
                        },
                        "description": "Linked records per relationship. Only on a single record."
                    }
                }
            },
            "ContactsInput": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "description": "Name"
                    },
                    "description": {
                        "type": "string",
                        "description": "Description"
                    },
                    "first_name": {
                        "type": "string",
                        "description": "First Name"
                    },
                    "last_name": {
                        "type": "string",
                        "description": "Last Name"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "description": "Email"
                    },
                    "phone": {
                        "type": "string",
                        "description": "Phone"
                    },
                    "position": {
                        "type": "string",
                        "description": "Position"
                    },
                    "notes": {
                        "type": "string",
                        "description": "Notes"
                    },
                    "avatar": {
                        "type": "string",
                        "description": "Profile Picture"
                    },
                    "address": {
                        "type": "object",
                        "description": "Address"
                    },
                    "mobile": {
                        "type": "string",
                        "description": "Mobile"
                    },
                    "salutation": {
                        "type": "string",
                        "enum": [
                            "mr",
                            "ms",
                            "mx",
                            "dr",
                            "prof"
                        ],
                        "description": "Salutation"
                    },
                    "department": {
                        "type": "string",
                        "description": "Department"
                    },
                    "marketing_consent": {
                        "type": "boolean",
                        "description": "Marketing Consent"
                    },
                    "consent_date": {
                        "type": "string",
                        "format": "date",
                        "description": "Consent Date"
                    }
                },
                "required": [
                    "name"
                ],
                "additionalProperties": false
            },
            "Record": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    }
                },
                "additionalProperties": true
            },
            "RecordInput": {
                "type": "object",
                "description": "The module's writable fields, custom fields included, as one flat object. Download your workspace's OpenAPI file from API Tokens for the exact fields. `line_items` on quotes and orders, `attendees` on meetings.",
                "properties": {
                    "line_items": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/LineItemInput"
                        }
                    },
                    "attendees": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AttendeeInput"
                        }
                    }
                },
                "additionalProperties": true
            }
        },
        "responses": {
            "Unauthenticated": {
                "description": "The token is missing, invalid or revoked.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "The token lacks the ability for this module and action.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "No such record, or a module the API can't reach.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "ValidationFailed": {
                "description": "A value was refused. `errors` names each field, such as `line_items.0.sku`.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ValidationError"
                        }
                    }
                }
            },
            "TooManyRequests": {
                "description": "Rate limit reached. Retry after the time in the Retry-After header.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        }
    }
}
