{
  "openapi": "3.1.1",
  "info": {
    "title": "OnDeck Vision API",
    "description": "OnDeck Vision API for visual understanding",
    "version": "0.0.7"
  },
  "servers": [
    {
      "url": "https://api.ondeckai.com/api/v1",
      "description": "Production Endpoint"
    }
  ],
  "security": [
    {
      "apiToken": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Token"
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "Number of results per page (1-500)",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500,
          "default": 50
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "description": "Optional pagination cursor for retrieving the next page.",
        "schema": {
          "type": "string"
        }
      },
      "created_after": {
        "name": "created_after",
        "in": "query",
        "description": "Filter by creation date (ISO 8601 timestamp)",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "created_before": {
        "name": "created_before",
        "in": "query",
        "description": "Filter by creation date (ISO 8601 timestamp)",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "sort": {
        "name": "sort",
        "in": "query",
        "description": "Sort order for results. Only `createdAt` is supported as a sort field. Format: `createdAt:asc` or `createdAt:desc`.",
        "schema": {
          "type": "string",
          "enum": ["createdAt:asc", "createdAt:desc"],
          "default": "createdAt:desc"
        }
      },
      "input_status": {
        "name": "status",
        "in": "query",
        "description": "Filter by input status",
        "schema": {
          "type": "string",
          "enum": [
            "valid",
            "invalid",
            "processing",
            "unknown"
          ]
        }
      },
      "input_type": {
        "name": "type",
        "in": "query",
        "description": "Filter by media type",
        "schema": {
          "type": "string",
          "enum": [
            "video",
            "photo"
          ]
        }
      },
      "input_project": {
        "name": "project",
        "in": "query",
        "description": "Filter by project ID",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "input_collection": {
        "name": "collection",
        "in": "query",
        "description": "Filter by collection ID",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "collection_type": {
        "name": "type",
        "in": "query",
        "description": "Filter by collection type",
        "schema": {
          "type": "string",
          "enum": [
            "video",
            "photo"
          ]
        }
      },
      "collection_project": {
        "name": "project",
        "in": "query",
        "description": "Filter by project ID",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "query_project": {
        "name": "project",
        "in": "query",
        "description": "Filter by project ID",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "query_status": {
        "name": "status",
        "in": "query",
        "description": "Filter by query status",
        "schema": {
          "type": "string",
          "enum": [
            "processing",
            "completed",
            "failed",
            "unknown"
          ]
        }
      },
      "query_type": {
        "name": "type",
        "in": "query",
        "description": "Filter by query type",
        "schema": {
          "type": "string",
          "enum": [
            "synchronous",
            "asynchronous",
            "background"
          ]
        }
      },
      "query_use_preset": {
        "name": "use_preset",
        "in": "query",
        "description": "Filter by preset usage",
        "schema": {
          "type": "boolean"
        }
      },
      "query_model": {
        "name": "model",
        "in": "query",
        "description": "Filter by the model used to generate the query result",
        "schema": {
          "type": "string",
          "enum": [
            "perception-0-fast",
            "perception-0-thinking"
          ]
        }
      },
      "user_role": {
        "name": "role",
        "in": "query",
        "description": "Filter by user role",
        "schema": {
          "type": "string",
          "enum": [
            "client",
            "org_admin"
          ]
        }
      }
    },
    "schemas": {
      "PaginationMetadata": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "example": 50,
            "description": "Number of items per page"
          },
          "next_cursor": {
            "type": "string",
            "example": "eyJjcmVhdGVkQXQiOiIyMDI1LTAxLTAxVDAwOjAwOjAwWiIsImlkIjoiYWJjMTIzIn0",
            "description": "Optional pagination cursor for retrieving the next page."
          },
          "has_more": {
            "type": "boolean",
            "example": true,
            "description": "Whether there are more items available"
          }
        }
      },
      "PaginatedInputsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Input"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PaginatedCollectionsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Collection"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PaginatedQueriesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Query"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PaginatedProjectsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Project"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PaginatedUsersResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/User"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PaginatedOrganizationsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Organization"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "DeletionError": {
        "type": "object",
        "properties": {
          "errorID": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the error"
          },
          "message": {
            "type": "string",
            "description": "Error message describing why the resource cannot be deleted"
          },
          "dependencies": {
            "type": "string",
            "description": "Description of which dependencies are blocking deletion"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "errorID": {
            "type": "string",
            "format": "uuid"
          },
          "message": {
            "type": "string",
            "description": "A short description of the error"
          }
        }
      },
      "GenericMessage": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "org_admin",
              "client"
            ]
          },
          "project_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "List of project IDs the user has access to"
          },
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "is_service_account": {
            "type": "boolean"
          }
        }
      },
      "ProjectUser": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "org_admin",
              "client"
            ]
          },
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "is_service_account": {
            "type": "boolean"
          }
        }
      },
      "CreateUserRequest": {
        "type": "object",
        "required": [
          "name",
          "role",
          "email"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "org_admin",
              "client"
            ],
            "description": "Must be of equal or lesser privilege than the calling user."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "project_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "List of project IDs the `client` role user will have access to. If not provided, the user will only have access to the default project. `org_admin` users have access to all projects."
          }
        }
      },
      "CreateTokenRequest": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the user to create a token for. If not provided, the token will be created for the calling user. Only org_admin role can create tokens for other users."
          },
          "role": {
            "type": "string",
            "enum": [
              "org_admin",
              "client"
            ]
          },
          "description": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "CreateTokenResponse": {
        "type": "object",
        "properties": {
          "token_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string",
            "enum": [
              "org_admin",
              "client"
            ]
          },
          "token": {
            "type": "string",
            "example": "ond.1_DEADBEEF"
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "TokenResponse": {
        "type": "object",
        "properties": {
          "token_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_email": {
            "type": "string",
            "format": "email",
            "description": "Email of the user or service account that owns this token."
          },
          "role": {
            "type": "string",
            "enum": [
              "org_admin",
              "client"
            ]
          },
          "token": {
            "type": "string",
            "example": "ond.1_XXXXXXXXXX"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "Input": {
        "type": "object",
        "properties": {
          "input_id": {
            "type": "string",
            "format": "uuid",
            "example": "123e4567-e89b-12d3-a456-426614174000"
          },
          "signed_url": {
            "type": "string",
            "format": "uri"
          },
          "file_name": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "valid",
              "invalid",
              "unknown"
            ]
          },
          "project_id": {
            "type": "string",
            "format": "uuid",
            "example": "9121f30d-af29-46ab-a7be-11c9a072ee16"
          },
          "collection_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the Collections the Input belongs to."
          },
          "details": {
            "type": "object",
            "nullable": true,
            "maxProperties": 20,
            "additionalProperties": {
              "type": "string",
              "maxLength": 1024
            }
          },
          "indexed": {
            "type": "boolean",
            "description": "Whether the video has completed indexing for enhanced querying."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-04-20T12:34:56.000Z"
          }
        }
      },
      "PreSignedUrlRequest": {
        "type": "object",
        "required": [
          "file_name"
        ],
        "properties": {
          "file_name": {
            "type": "string",
            "description": "Name of the input file (video or image) to upload. File names are unique within a project. Uploading a file to an existing input will overwrite the existing file, and add it to any new Collections if specified. Membership to previously added Collections will not be removed.",
            "pattern": "^[a-zA-Z0-9!\\-_.()*]+\\.([a-zA-Z]+)$",
            "maxLength": 255,
            "example": "video.mp4"
          },
          "collection_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the Collections the Input belongs to. The Collections must belong to the same project as the Input. If not provided, the file will not be added to a Collection. You can still query on the Input individually."
          },
          "details": {
            "type": "object",
            "maxProperties": 20,
            "additionalProperties": {
              "type": "string",
              "maxLength": 1024
            }
          }
        }
      },
      "FeedbackRequest": {
        "type": "object",
        "required": [
          "query_id",
          "correct"
        ],
        "properties": {
          "query_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Query to provide feedback on"
          },
          "correct": {
            "type": "boolean",
            "description": "Whether the answer was marked correct or not"
          },
          "corrected_answer": {
            "nullable": true,
            "description": "The corrected answer"
          },
          "feedback_context": {
            "type": "string",
            "description": "Optional description"
          }
        }
      },
      "Collection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "photo",
              "video"
            ]
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "inputs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "List of input IDs in the collection"
          }
        }
      },
      "CreateCollectionRequest": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the collection"
          },
          "type": {
            "type": "string",
            "enum": [
              "photo",
              "video"
            ],
            "description": "Input type of the collection. A collection can only contain all video inputs or all photo inputs."
          }
        }
      },
      "CreateInputInCollectionRequest": {
        "type": "object",
        "required": [
          "input_id"
        ],
        "properties": {
          "input_id": {
            "type": "string",
            "description": "Id of the Input to add to the Collection. The Collection must belong to the same project as the Input."
          }
        }
      },
      "Query": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "input_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "collection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "query_type": {
            "type": "string",
            "enum": [
              "asynchronous",
              "synchronous",
              "background"
            ]
          },
          "model": {
            "type": "string",
            "enum": [
              "perception-0-fast",
              "perception-0-thinking"
            ],
            "description": "The perception model used for this query."
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "completed",
              "failed"
            ],
            "description": "The status of the query. Synchronous queries always return completed status."
          },
          "use_preset": {
            "type": "boolean",
            "description": "Whether structured output was requested for this query."
          },
          "question": {
            "type": "string",
            "nullable": true,
            "example": "What's happening in this video?"
          },
          "short_answer": {
            "type": "string",
            "nullable": true,
            "description": "Natural language answer. Populated when `use_preset` is false."
          },
          "answer_uri": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "description": "URI to full answer when result is too long."
          },
          "structured_answer": {
            "type": "object",
            "nullable": true,
            "description": "Structured JSON response when `use_preset` is true. Reach out to support@ondeckai.com to configure structured responses."
          },
          "feedback": {
            "type": "object",
            "nullable": true,
            "description": "User feedback",
            "properties": {
              "correct": {
                "type": "boolean",
                "nullable": true,
                "description": "Whether the answer was marked correct or not"
              },
              "corrected_answer": {
                "nullable": true,
                "description": "The corrected answer"
              },
              "feedback_context": {
                "type": "string",
                "nullable": true,
                "description": "Optional description"
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-04-20T12:34:56.000Z"
          }
        }
      },
      "BackgroundQuery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "input_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "collection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "query_type": {
            "type": "string",
            "enum": [
              "background"
            ]
          },
          "model": {
            "type": "string",
            "enum": [
              "perception-0-fast",
              "perception-0-thinking"
            ],
            "description": "The perception model used for this query."
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "use_preset": {
            "type": "boolean"
          },
          "question": {
            "type": "string",
            "nullable": true,
            "example": "What's happening in this video?"
          },
          "short_answer": {
            "type": "string",
            "nullable": true,
            "description": "Answer to `synchronous` queries."
          },
          "answer_uri": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "description": "URI to full answer when `short_answer` is too long"
          },
          "structured_answer": {
            "type": "object",
            "nullable": true,
            "description": "**Private preview:** structured response when using custom queries. Reach out to support@ondeckai.com to define your own structured response."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-04-20T12:34:56.000Z"
          }
        }
      },
      "CreateQueryRequest": {
        "type": "object",
        "required": [
          "question"
        ],
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "perception-0-fast",
              "perception-0-thinking"
            ],
            "default": "perception-0-fast",
            "description": "The perception model to use."
          },
          "query_type": {
            "type": "string",
            "enum": [
              "synchronous",
              "asynchronous"
            ],
            "default": "synchronous",
            "description": "The type of the query. Synchronous queries block and return results in response. `perception-0-thinking` requires `asynchronous`."
          },
          "question": {
            "type": "string",
            "maxLength": 10000,
            "description": "The question to ask about the input content. Required when `use_preset` is false."
          },
          "ignore_artifacts": {
            "type": "boolean",
            "description": "Skips using pre-processing enhancements for queries. Increases latency, ignored for `perception-0-thinking`.",
            "default": false
          },
          "use_preset": {
            "type": "boolean",
            "description": "Return a structured JSON response instead of natural language. When true, the response populates `structured_answer` instead of `short_answer`. Reach out to support@ondeckai.com to configure structured responses.",
            "default": false
          }
        }
      },
      "CreateCollectionQueryRequest": {
        "type": "object",
        "required": [
          "question"
        ],
        "properties": {
          "query_type": {
            "type": "string",
            "enum": [
              "synchronous",
              "asynchronous"
            ],
            "default": "synchronous",
            "description": "The type of the query. Synchronous queries block and return results in response. For video input collections, queries **must** use artifacts from the auto-triggered `analyze` inference job."
          },
          "question": {
            "type": "string",
            "maxLength": 10000,
            "description": "The question to ask about the input content. Required if `use_preset` is false."
          },
          "use_preset": {
            "type": "boolean",
            "description": "**Private preview:** Use custom context for synchronous queries. If set to true, the response populates `structured_answer`. Reach out to support@ondeckai.com to setup custom context and structured responses.",
            "default": false
          }
        }
      },
      "Organization": {
        "type": "object",
        "properties": {
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "default_project_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Project": {
        "type": "object",
        "properties": {
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "organization_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "CreateProjectRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The display name of the new project"
          }
        }
      },
      "UserProjectManagementResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      }
    }
  },
  "paths": {
    "/inputs": {
      "get": {
        "summary": "List inputs",
        "description": "Get a paginated list of all Inputs in accessible projects",
        "tags": [
          "Inputs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/input_status"
          },
          {
            "$ref": "#/components/parameters/input_type"
          },
          {
            "$ref": "#/components/parameters/input_project"
          },
          {
            "$ref": "#/components/parameters/input_collection"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of Inputs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInputsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Project not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pre-signed-url": {
      "post": {
        "summary": "Create Input",
        "description": "Returns a new Input with a pre-signed URL for uploading an image or video file",
        "tags": [
          "Inputs"
        ],
        "parameters": [
          {
            "name": "OnDeck-Project",
            "in": "header",
            "required": false,
            "description": "Project ID for the input. If not provided, the input will be created in the default project.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreSignedUrlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Input created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Input"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/inputs/{id}": {
      "get": {
        "summary": "Get input by ID",
        "description": "Get a single Input by its ID",
        "tags": [
          "Inputs"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Input to retrieve.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Input object",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Input"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete input",
        "description": "Delete an Input. Associated Queries will also be deleted.",
        "tags": [
          "Inputs"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Input to delete.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Input deleted successfully"
          },
          "400": {
            "description": "Cannot delete input with existing dependencies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/collections": {
      "get": {
        "summary": "List collections",
        "description": "Get a paginated list of all Collections in accessible projects",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/collection_type"
          },
          {
            "$ref": "#/components/parameters/collection_project"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of Collections",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCollectionsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Project not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create collection",
        "description": "Create a new Collection",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "name": "OnDeck-Project",
            "in": "header",
            "required": false,
            "description": "Project ID for the Collection. If not provided, the Collection will be created in the default project.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCollectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Collection created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Project not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/collections/{id}/inputs": {
      "get": {
        "summary": "List inputs in collection",
        "description": "Get a paginated list of Inputs belonging to a specific Collection",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the Collection to retrieve Inputs for."
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/sort"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of Inputs in Collection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInputsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/collections/{id}": {
      "get": {
        "summary": "Get collection by ID",
        "description": "Get a single Collection by its ID",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Collection object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete collection",
        "description": "Delete a Collection. Collections must be empty before deletion.",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Collection to delete.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Collection deleted successfully"
          },
          "400": {
            "description": "Cannot delete collection with existing dependencies. You must first remove or delete all Inputs in the Collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/collections/{id}/inputs/{input_id}": {
      "put": {
        "summary": "Add input to a collection",
        "description": "Add an existing Input to a specific Collection",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the Collection to add the Input to."
          },
          {
            "name": "input_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the Input to add to the Collection. The Input must be in the same project as the Collection."
          }
        ],
        "responses": {
          "201": {
            "description": "Input successfully added to Collection."
          },
          "204": {
            "description": "Input already in Collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericMessage"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Input can not be added to collection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove input from collection",
        "description": "Remove an input from a collection.",
        "tags": [
          "Collections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The collection ID"
          },
          {
            "name": "input_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The input ID to remove"
          }
        ],
        "responses": {
          "204": {
            "description": "Input successfully removed from collection"
          },
          "400": {
            "description": "Bad request (missing required identifier)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found (collection not found, input not found, or input is not a member of this collection)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/queries": {
      "get": {
        "summary": "List queries",
        "description": "Get a paginated list of all Queries in accessible projects",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/query_status"
          },
          {
            "$ref": "#/components/parameters/query_type"
          },
          {
            "$ref": "#/components/parameters/query_use_preset"
          },
          {
            "$ref": "#/components/parameters/query_model"
          },
          {
            "$ref": "#/components/parameters/query_project"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of Queries",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedQueriesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/inputs/{id}/queries": {
      "get": {
        "summary": "Get input queries",
        "description": "Get a paginated list of Queries belonging to a specific Input",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Input to retrieve queries for.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/query_type"
          },
          {
            "$ref": "#/components/parameters/query_use_preset"
          },
          {
            "$ref": "#/components/parameters/query_status"
          },
          {
            "$ref": "#/components/parameters/query_model"
          },
          {
            "$ref": "#/components/parameters/sort"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of queries for input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedQueriesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Query an Input",
        "description": "Query an individual Input",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Input to query. The Input must be uploaded and in a valid state for queries.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Query processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Query"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Input is still processing or is not in valid state.",
            "content": {
              "application/json": {
                "example": {
                  "errorID": "a664295e-41dc-4f59-980c-1195ccd9bdbb",
                  "message": "Input 24647a90-f9f8-45f5-a9a5-f0fe73a44fc2 (demo.mp4) is not ready for processing yet"
                }
              }
            }
          }
        }
      }
    },
    "/collections/{id}/queries": {
      "get": {
        "summary": "Get collection queries",
        "description": "Get a paginated list of Queries belonging to a specific Collection",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the Collection to retrieve Queries for. Collections only support synchronous queries."
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "name": "type",
            "in": "query",
            "description": "Filter by query type",
            "schema": {
              "type": "string",
              "enum": [
                "synchronous",
                "asynchronous"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/query_use_preset"
          },
          {
            "$ref": "#/components/parameters/query_status"
          },
          {
            "$ref": "#/components/parameters/sort"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of Queries in Collection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedQueriesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Query a Collection",
        "description": "Query a Collection of Inputs",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the Collection to query. All Inputs in the Collection must be uploaded and in a valid state for queries. Queries on a video Collection are disabled until each video in the Collection has completed it's background `analysis` pre-processing ."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCollectionQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Query processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Query"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Input is still processing or is not in valid state.",
            "content": {
              "application/json": {
                "example": {
                  "errorID": "a664295e-41dc-4f59-980c-1195ccd9bdbb",
                  "message": "Collection 24647a90-f9f8-45f5-a9a5-f0fe73a44fc2 (name) is not ready for queries yet"
                }
              }
            }
          }
        }
      }
    },
    "/inputs/{id}/background-queries": {
      "get": {
        "summary": "Poll for background query",
        "description": "Get a single background Query belonging to a specific Input, if it exists. Email support@ondeckai.com if you need background queries enabled for your organization",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Query object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackgroundQuery"
                }
              }
            }
          },
          "202": {
            "description": "No background query found for input. Either background queries are not configured or it hasn't been created yet, try again later.",
            "content": {
              "application/json": {
                "schema": {
                  "message": "No background query found, please try again"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity. Input is not valid yet, try again later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/queries/{id}": {
      "get": {
        "summary": "Poll query by ID",
        "description": "Get a single Query by ID. Typically used for asynchronous queries to poll for results",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Query object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Query"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete query",
        "description": "Delete a Query",
        "tags": [
          "Queries"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Query to delete.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Query deleted successfully"
          },
          "400": {
            "description": "Cannot delete query with existing dependencies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/feedback": {
      "post": {
        "summary": "Create feedback",
        "description": "Provide Feedback on a Query",
        "tags": [
          "Feedback"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Feedback received successfully"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations": {
      "get": {
        "summary": "Get organization",
        "description": "Get Organizations. Returns an array with the user's organization.",
        "tags": [
          "Organizations"
        ],
        "responses": {
          "200": {
            "description": "Array of Organizations. Users receive an array with their own organization.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Organization"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects": {
      "get": {
        "summary": "List projects",
        "description": "Get a paginated list of all Projects the calling entity has access to",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/sort"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of projects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedProjectsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create project",
        "description": "Create a new Project in the calling entity's Organization. Requires organization admin role",
        "tags": [
          "Projects"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Project created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{id}/users": {
      "get": {
        "summary": "Get project users",
        "description": "Get all users assigned to a project. Requires organization admin role",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The project ID"
          }
        ],
        "responses": {
          "200": {
            "description": "List of users assigned to the project",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectUser"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{id}": {
      "get": {
        "summary": "Get project by ID",
        "description": "Get a single Project by ID",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the Project to retrieve."
          }
        ],
        "responses": {
          "200": {
            "description": "Project resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete project",
        "description": "Delete a Project. Projects with dependencies cannot be deleted. Requires organization admin role",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the Project to delete.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Project deleted successfully"
          },
          "400": {
            "description": "Cannot delete project with existing dependencies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{id}/users/{user_id}": {
      "put": {
        "summary": "Add user to project",
        "description": "Add a user to a project. Requires organization admin role",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The project ID"
          },
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The user ID to add"
          }
        ],
        "responses": {
          "200": {
            "description": "User added to project successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProjectManagementResponse"
                },
                "example": {
                  "message": "user added to project successfully",
                  "project_id": "123e4567-e89b-12d3-a456-426614174000",
                  "user_id": "123e4567-e89b-12d3-a456-426614174001"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - project_id and user_id required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - cannot add user from different organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - project or user not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove user from project",
        "description": "Remove a user from a project. Requires organization admin role",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The project ID"
          },
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The user ID to remove"
          }
        ],
        "responses": {
          "200": {
            "description": "User removed from project successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProjectManagementResponse"
                },
                "example": {
                  "message": "user removed from project successfully",
                  "project_id": "123e4567-e89b-12d3-a456-426614174000",
                  "user_id": "123e4567-e89b-12d3-a456-426614174001"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - project_id and user_id required or user not in project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - project or user not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users": {
      "get": {
        "summary": "List users",
        "description": "Get a paginated list of all Users in the calling entity's Organization. Only `org_admin` role can list other users",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/user_role"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of Users",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedUsersResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "summary": "Create service account",
        "description": "Create a **service account** in the calling entity's Organization. Requires `org_admin` role.",
        "tags": [
          "Users"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "User created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}": {
      "get": {
        "summary": "Get user by ID",
        "description": "Get a single User by ID",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ID of the User to retrieve."
          }
        ],
        "responses": {
          "200": {
            "description": "User resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "404": {
            "description": "User not found"
          }
        }
      },
      "delete": {
        "summary": "Delete user",
        "description": "Delete a User. Requires organization admin role",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The ID of the User to delete.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "User deleted successfully"
          },
          "400": {
            "description": "Cannot delete user with existing dependencies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - insufficient permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}/projects/{project_id}": {
      "put": {
        "summary": "Add project to user",
        "description": "Add a project to a user's accessible projects. Requires organization admin role",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The user ID"
          },
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The project ID to add"
          }
        ],
        "responses": {
          "200": {
            "description": "Project added to user successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProjectManagementResponse"
                },
                "example": {
                  "message": "project added to user successfully",
                  "user_id": "123e4567-e89b-12d3-a456-426614174001",
                  "project_id": "123e4567-e89b-12d3-a456-426614174000"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - user_id and project_id required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - user or project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove project from user",
        "description": "Remove a project from a user's accessible projects. Requires organization admin role",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The user ID"
          },
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The project ID to remove"
          }
        ],
        "responses": {
          "200": {
            "description": "Project removed from user successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProjectManagementResponse"
                },
                "example": {
                  "message": "project removed from user successfully",
                  "user_id": "123e4567-e89b-12d3-a456-426614174001",
                  "project_id": "123e4567-e89b-12d3-a456-426614174000"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - user_id and project_id required or user doesn't have access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - cannot remove project from different organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - user or project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/tokens": {
      "get": {
        "summary": "List API tokens",
        "description": "Get a list of API tokens. Only `org_admin` role can list tokens for other users",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/created_after"
          },
          {
            "$ref": "#/components/parameters/created_before"
          },
          {
            "name": "user_id",
            "in": "query",
            "description": "Filter by user ID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "role",
            "in": "query",
            "description": "Filter by role",
            "schema": {
              "type": "string",
              "enum": [
                "org_admin",
                "client"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Sort results (format: field:asc or field:desc). Sortable fields: `createdAt`",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of API tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TokenResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create API token",
        "description": "Create an API token for a User",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/tokens/{id}": {
      "delete": {
        "summary": "Delete API token",
        "description": "Delete an API token",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "id",
            "description": "The token ID to delete",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Token deleted successfully"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Clients can only delete their own tokens or Cannot delete token from different organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Token not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Inputs",
      "description": "Upload and manage video and image files"
    },
    {
      "name": "Collections",
      "description": "Group inputs for multi-file queries"
    },
    {
      "name": "Queries",
      "description": "Query inputs and collections for visual understanding"
    },
    {
      "name": "Feedback",
      "description": "Provide feedback on results"
    },
    {
      "name": "Organizations",
      "description": "Organization management"
    },
    {
      "name": "Projects",
      "description": "Project organization and access control"
    },
    {
      "name": "Users",
      "description": "User management and authentication"
    },
    {
      "name": "Auth",
      "description": "Authentication and API tokens"
    }
  ]
}