Affinda Document Types API

Manage document type definitions — the model configuration governing how a specific document category (invoice, resume, custom contract) is parsed. Each document type exposes a JSON Schema and optional Pydantic model representation. Document types are configured in the dashboard or natural-language workflow builder and reused across workspaces and collections.

Operations 7

GET /v3/document_types List document types #
POST /v3/document_types Create a document type #
GET /v3/document_types/{identifier} Get a document type #
PATCH /v3/document_types/{identifier} Update a document type #
DELETE /v3/document_types/{identifier} Delete a document type #
GET /v3/document_types/{identifier}/json_schema Generate JSON schema from a document type #
GET /v3/document_types/{identifier}/pydantic_models Generate Pydantic models from a document type #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/affinda-document-types-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

affinda-document-types-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Affinda Annotations Add x-hidden to endpoints Document Types API
  version: 3.0.0
  description: Affinda Annotations API — subset of the Affinda v3 Document Processing API.
servers:
- url: https://{region}.affinda.com
  description: 'Select the correct server for your instance: api (AUS/Global), api.us1 (US), or api.eu1 (EU).'
  variables:
    region:
      default: api
      description: The instance region. Use 'api' for AUS/Global, 'api.us1' for US, or 'api.eu1' for EU. You can find your region in the Affinda web app URL.
      enum:
      - api
      - api.eu1
      - api.us1
      x-ms-parameter-location: client
security:
- ApiKeyAuth: []
tags:
- name: Document Types
paths:
  /v3/document_types:
    get:
      tags:
      - Document Types
      summary: List document types
      description: Returns a list of document types that the user has access to.
      operationId: getDocumentTypes
      parameters:
      - name: organization
        in: query
        description: Filter by organization identifier
        required: false
        schema:
          type: string
      - name: workspace
        in: query
        description: Filter by workspace identifier
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DocumentType'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
    post:
      tags:
      - Document Types
      summary: Create a document type
      description: Create a new document type in the specified organization.
      operationId: createDocumentType
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentTypeCreate'
      responses:
        '201':
          description: Document type created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentType'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        '403':
          description: Forbidden - User doesn't have permission to create document types in this organization
        default:
          $ref: '#/components/responses/DefaultError'
  /v3/document_types/{identifier}:
    get:
      tags:
      - Document Types
      summary: Get a document type
      description: Returns the details of a specific document type.
      operationId: getDocumentType
      parameters:
      - in: path
        required: true
        name: identifier
        description: Document type identifier
        schema:
          type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentType'
        '401':
          $ref: '#/components/responses/401Error'
        '404':
          description: Document type not found
        default:
          $ref: '#/components/responses/DefaultError'
    patch:
      tags:
      - Document Types
      summary: Update a document type
      description: Update an existing document type.
      operationId: updateDocumentType
      parameters:
      - in: path
        required: true
        name: identifier
        description: Document type identifier
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentTypeUpdate'
      responses:
        '200':
          description: Document type updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentType'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        '403':
          description: Forbidden - User doesn't have permission to update this document type
        '404':
          description: Document type not found
        default:
          $ref: '#/components/responses/DefaultError'
    delete:
      tags:
      - Document Types
      summary: Delete a document type
      description: Delete a document type.
      operationId: deleteDocumentType
      parameters:
      - in: path
        required: true
        name: identifier
        description: Document type identifier
        schema:
          type: string
      responses:
        '204':
          $ref: '#/components/responses/204NoContent'
        '401':
          $ref: '#/components/responses/401Error'
        '403':
          description: Forbidden - User doesn't have permission to delete this document type
        '404':
          description: Document type not found
        default:
          $ref: '#/components/responses/DefaultError'
  /v3/document_types/{identifier}/json_schema:
    get:
      tags:
      - Document Types
      summary: Generate JSON schema from a document type
      operationId: jsonSchemaFromDocumentType
      description: Generate JSON schema from a document type.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Document type's identifier
        schema:
          $ref: '#/components/schemas/DocumentType_properties-identifier'
      - in: query
        name: title
        description: Title for the JSON schema
        schema:
          type: string
      responses:
        '200':
          description: JSON schema for the document type.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
  /v3/document_types/{identifier}/pydantic_models:
    get:
      tags:
      - Document Types
      summary: Generate Pydantic models from a document type
      operationId: pydanticModelsFromDocumentType
      description: Generate Pydantic models from a document type.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Document type's identifier
        schema:
          $ref: '#/components/schemas/DocumentType_properties-identifier'
      - in: query
        name: model_name
        description: Name for the Pydantic model
        schema:
          type: string
      responses:
        '200':
          description: Pydantic models for the document type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PydanticModelsResponse'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
components:
  schemas:
    PydanticModelsResponse:
      type: object
      required:
      - code
      properties:
        code:
          type: string
          description: Pydantic model code
    DocumentTypeCreate:
      type: object
      required:
      - name
      - organization
      properties:
        name:
          type: string
          description: The name of the document type.
        description:
          type:
          - string
          - 'null'
          description: A description of the document type.
        organization:
          type: string
          description: The identifier of the organization this document type belongs to.
    DocumentTypeUpdate:
      type: object
      properties:
        name:
          type: string
          description: The new name of the document type.
        description:
          type:
          - string
          - 'null'
          description: A new description of the document type.
    DocumentType:
      type: object
      required:
      - identifier
      - name
      - organization
      properties:
        identifier:
          type: string
          description: Uniquely identify a document type.
          example: mEFayXdO
        name:
          type: string
          description: The name of the document type.
        description:
          type:
          - string
          - 'null'
          description: A description of the document type.
        ingest_email:
          type: string
          description: The email address that can be used to email documents directly to this document type.
        organization:
          type: string
          description: The identifier of the organization this document type belongs to.
    DocumentType_properties-identifier:
      type: string
      description: Uniquely identify a document type.
      example: mEFayXdO
    RequestError:
      type: object
      additionalProperties: false
      required:
      - type
      - errors
      properties:
        type:
          type: string
          example: validation_error
        errors:
          type: array
          items:
            type: object
            required:
            - attr
            - code
            - detail
            properties:
              attr:
                type:
                - string
                - 'null'
                example: non_field_errors
              code:
                type: string
                example: unique
              detail:
                type: string
                example: This index name has already been used
  responses:
    400Error:
      description: Bad request. If it is a validation error will contain a list of each invalid field
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      x-ms-error-response: true
    204NoContent:
      description: Delete successful, no content returned
    DefaultError:
      description: UnexpectedError
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      x-ms-error-response: true
    401Error:
      description: Authorisation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      x-ms-error-response: true
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: 'Basic authentication using an API key, e.g. `{Authorization: Bearer aff_0bb4fbdf97b7e4111ff6c0015471094155f91}`.

        You can find your API key within the Settings page of the [Affinda web app](https://app.affinda.com/). You can obtain an API key by [signing up for a free trial](https://app.affinda.com/auth/register).'