Affinda Workspaces API

Workspaces group together related collections, documents, members, and webhook subscriptions. Workspace identifiers scope every document upload, listing, and webhook delivery. Includes per-workspace usage reporting for credits and pages processed.

OpenAPI Specification

affinda-workspaces-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Affinda Annotations Add x-hidden to endpoints Workspaces 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: Workspaces
  description: 'Operations to manage workspaces.


    Workspaces group together related collections of documents.

    '
paths:
  /v3/workspaces:
    get:
      tags:
      - Workspaces
      summary: Get list of all workspaces
      operationId: getAllWorkspaces
      description: Returns your workspaces.
      parameters:
      - in: query
        name: organization
        required: true
        schema:
          $ref: '#/components/schemas/Organization_properties-identifier'
        description: Filter by organization.
      - in: query
        name: name
        schema:
          type: string
        description: Filter by name.
      responses:
        '200':
          description: All matching workspaces.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Workspace'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
    post:
      tags:
      - Workspaces
      summary: Create a workspace
      operationId: createWorkspace
      description: Create a workspace
      responses:
        '201':
          description: Successfully created a workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
      requestBody:
        description: Workspace to create
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceCreate'
  /v3/workspaces/{identifier}:
    get:
      tags:
      - Workspaces
      summary: Get specific workspace
      operationId: getWorkspace
      description: Return a specific workspace.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Workspace's identifier
        schema:
          $ref: '#/components/schemas/identifier'
      responses:
        '200':
          description: Successfully retrieved workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
    patch:
      tags:
      - Workspaces
      summary: Update a workspace
      operationId: updateWorkspace
      description: Update a workspace.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Workspace's identifier
        schema:
          $ref: '#/components/schemas/identifier'
      requestBody:
        description: Workspace data to update
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceUpdate'
      responses:
        '200':
          description: Successfully updated workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
    delete:
      tags:
      - Workspaces
      summary: Delete a workspace
      operationId: deleteWorkspace
      description: Deletes the specified workspace from the database.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Workspace's identifier
        schema:
          $ref: '#/components/schemas/identifier'
      responses:
        '204':
          $ref: '#/components/responses/204NoContent'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
  /v3/workspaces/{identifier}/usage:
    get:
      x-hidden: true
      tags:
      - Workspaces
      summary: Get usage by workspace
      operationId: getUsageByWorkspace
      description: 'Return monthly credits consumption of a workspace.

        Deprecated: use `GET /v3/usage?organization={id}&workspace={id}` instead. The new endpoint returns a unified daily series and supports the same workspace scoping along with organization- and document-type-level reporting.'
      deprecated: true
      parameters:
      - in: path
        required: true
        name: identifier
        description: Workspace's identifier
        schema:
          $ref: '#/components/schemas/identifier'
      - in: query
        required: false
        name: start
        description: 'Start date of the period to retrieve. Format: YYYY-MM'
        schema:
          type: string
          example: 2023-07
      - in: query
        required: false
        name: end
        description: 'End date of the period to retrieve. Format: YYYY-MM'
        schema:
          type: string
          example: 2023-10
      responses:
        '200':
          description: Monthly credits consumption of a workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageByWorkspaceResponse'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
  /v3/workspace_memberships:
    get:
      x-hidden: true
      tags:
      - Workspaces
      summary: Get list of all workspace memberships
      operationId: getAllWorkspaceMemberships
      description: Returns the memberships of your workspaces.
      parameters:
      - $ref: '#/components/parameters/offsetParam'
      - $ref: '#/components/parameters/limitParam'
      - in: query
        name: workspace
        schema:
          $ref: '#/components/schemas/identifier'
        description: Filter by workspace.
      - in: query
        name: user
        schema:
          type: string
        description: Partial text match on user's email, case-insensitive.
      responses:
        '200':
          description: All matching workspace memberships.
          content:
            application/json:
              schema:
                type: object
                required:
                - results
                - count
                allOf:
                - $ref: '#/components/schemas/PaginatedResponse'
                - type: object
                  required:
                  - results
                  properties:
                    results:
                      type: array
                      items:
                        $ref: '#/components/schemas/WorkspaceMembership'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
    post:
      x-hidden: true
      tags:
      - Workspaces
      summary: Create a workspace membership
      operationId: createWorkspaceMembership
      description: Create a workspace membership.
      responses:
        '201':
          description: Successfully created a workspace membership.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceMembership'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceMembershipCreate'
  /v3/workspace_memberships/{identifier}:
    get:
      x-hidden: true
      tags:
      - Workspaces
      summary: Get specific workspace membership
      operationId: getWorkspaceMembership
      description: Return a specific workspace membership.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Workspace membership's identifier.
        schema:
          $ref: '#/components/schemas/WorkspaceMembership_properties-identifier'
      responses:
        '200':
          description: Successfully retrieved workspace membership.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceMembership'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
    delete:
      x-hidden: true
      tags:
      - Workspaces
      summary: Delete a workspace membership
      operationId: deleteWorkspaceMembership
      description: Remove an user from a workspace.
      parameters:
      - in: path
        required: true
        name: identifier
        description: Workspace membership's identifier.
        schema:
          $ref: '#/components/schemas/WorkspaceMembership_properties-identifier'
      responses:
        '204':
          $ref: '#/components/responses/204NoContent'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
components:
  responses:
    DefaultError:
      description: UnexpectedError
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      x-ms-error-response: true
    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
    401Error:
      description: Authorisation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      x-ms-error-response: true
  schemas:
    ThemeConfig:
      type: object
      properties:
        palette:
          type: object
          properties:
            mode:
              type: string
              enum:
              - light
              - dark
            background:
              oneOf:
              - type: string
              - type: object
                properties:
                  default:
                    type: string
                  paper:
                    type: string
            text:
              type: object
              properties:
                primary:
                  type: string
                secondary:
                  type: string
                disabled:
                  type: string
            divider:
              type: string
            primary:
              $ref: '#/components/schemas/PaletteColorOptions'
            secondary:
              $ref: '#/components/schemas/PaletteColorOptions'
            success:
              $ref: '#/components/schemas/PaletteColorOptions'
            annotation:
              $ref: '#/components/schemas/PaletteColorOptions'
            error:
              $ref: '#/components/schemas/PaletteColorOptions'
            info:
              $ref: '#/components/schemas/PaletteColorOptions'
            warning:
              $ref: '#/components/schemas/PaletteColorOptions'
        typography:
          type: object
          properties:
            fontFamily:
              type: string
            fontSize:
              oneOf:
              - type: string
              - type: number
            fontWeightRegular:
              type: string
            fontWeightMedium:
              type: string
            fontWeightBold:
              type: string
        borderRadius:
          type: number
        fontUrl:
          type: string
    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
                nullable: true
                example: non_field_errors
              code:
                type: string
                example: unique
              detail:
                type: string
                example: This index name has already been used
    UsageByWorkspace:
      type: object
      description: Monthly credits consumption
      required:
      - month
      - count
      properties:
        month:
          type: string
          description: Month of the usage
          example: 2023-07
        count:
          type: integer
          description: Usage count
          example: 100
      additionalProperties: false
    DocumentSplitter_properties-identifier:
      type: string
      description: Uniquely identify a document splitter.
      example: NqIvMvZl
    baseExtractor:
      type: object
      nullable: true
      required:
      - identifier
      - name
      - namePlural
      - validatable
      properties:
        identifier:
          $ref: '#/components/schemas/Extractor_properties-identifier'
        name:
          $ref: '#/components/schemas/name'
        namePlural:
          $ref: '#/components/schemas/namePlural'
        validatable:
          $ref: '#/components/schemas/validatable'
        isCustom:
          $ref: '#/components/schemas/isCustom'
        createdDt:
          $ref: '#/components/schemas/createdDt'
    WorkspaceMembership:
      type: object
      properties:
        identifier:
          type: string
          description: Uniquely identify a membership.
          example: mEFayXdO
        workspace:
          $ref: '#/components/schemas/identifier'
        user:
          $ref: '#/components/schemas/User'
    WorkspaceUpdate:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/name'
        visibility:
          $ref: '#/components/schemas/WorkspaceVisibility'
        rejectInvalidDocuments:
          $ref: '#/components/schemas/rejectInvalidDocuments'
        rejectDuplicates:
          $ref: '#/components/schemas/RejectDuplicates'
        documentTypes:
          type: array
          description: Document types to associate with this workspace
          items:
            $ref: '#/components/schemas/properties-identifier'
        whitelistIngestAddresses:
          $ref: '#/components/schemas/whitelistIngestAddresses'
        documentSplitter:
          $ref: '#/components/schemas/DocumentSplitter_properties-identifier'
          nullable: true
    WorkspaceCreate:
      type: object
      required:
      - organization
      - name
      properties:
        organization:
          $ref: '#/components/schemas/Organization_properties-identifier'
        name:
          $ref: '#/components/schemas/name'
        visibility:
          $ref: '#/components/schemas/WorkspaceVisibility'
        rejectInvalidDocuments:
          $ref: '#/components/schemas/rejectInvalidDocuments'
        rejectDuplicates:
          $ref: '#/components/schemas/RejectDuplicates'
        documentTypes:
          type: array
          description: Document types to associate with this workspace
          items:
            $ref: '#/components/schemas/properties-identifier'
        whitelistIngestAddresses:
          $ref: '#/components/schemas/whitelistIngestAddresses'
        documentSplitter:
          $ref: '#/components/schemas/DocumentSplitter_properties-identifier'
          nullable: true
    properties-id:
      type: integer
      description: Uniquely identify a user.
      example: 1
      minimum: 1
    createdDt:
      type: string
      format: date-time
    PaginatedResponse:
      type: object
      required:
      - count
      properties:
        count:
          type: integer
          example: 10
          description: Number of items in results.
          minimum: 0
        next:
          type: string
          nullable: true
          description: URL to request next page of results.
        previous:
          type: string
          nullable: true
          description: URL to request previous page of results.
    Organization_properties-identifier:
      type: string
      description: Uniquely identify an organization.
      example: mEFayXdO
    category:
      type: string
      nullable: true
      example: Recruitment
    UsageByWorkspaceResponse:
      type: array
      description: Monthly credits consumption
      items:
        $ref: '#/components/schemas/UsageByWorkspace'
    identifier:
      type: string
      description: Uniquely identify a workspace.
      example: mEFayXdO
    whitelistIngestAddresses:
      type: array
      nullable: true
      description: If specified, only emails from these addresses will be ingested for parsing. Wild cards are allowed, e.g. "*@eyefind.info".
      items:
        type: string
        example: '*@eyefind.info'
    properties-identifier:
      type: string
      description: Uniquely identify a collection.
      example: mEFayXdO
    namePlural:
      type: string
    rejectInvalidDocuments:
      type: boolean
      description: If true, the uploaded document will be rejected if it's of the wrong document type, or if its document type cannot be determined. No credits will be consumed.
    OrganizationRole:
      type: string
      enum:
      - admin
      - member
      example: admin
    Workspace:
      type: object
      required:
      - identifier
      properties:
        identifier:
          type: string
          description: Uniquely identify a workspace.
          example: mEFayXdO
        organization:
          $ref: '#/components/schemas/Organization'
        name:
          type: string
        visibility:
          $ref: '#/components/schemas/WorkspaceVisibility'
        collections:
          type: array
          items:
            type: object
            required:
            - identifier
            - name
            - extractor
            properties:
              identifier:
                $ref: '#/components/schemas/properties-identifier'
              name:
                $ref: '#/components/schemas/name'
              extractor:
                type: object
                required:
                - identifier
                - name
                - namePlural
                - validatable
                properties:
                  identifier:
                    $ref: '#/components/schemas/Extractor_properties-identifier'
                  name:
                    $ref: '#/components/schemas/name'
                  namePlural:
                    $ref: '#/components/schemas/namePlural'
                  baseExtractor:
                    $ref: '#/components/schemas/baseExtractor'
                  category:
                    $ref: '#/components/schemas/category'
                  validatable:
                    $ref: '#/components/schemas/validatable'
                  createdDt:
                    $ref: '#/components/schemas/createdDt'
              unvalidatedDocsCount:
                $ref: '#/components/schemas/unvalidatedDocsCount'
              confirmedDocsCount:
                $ref: '#/components/schemas/confirmedDocsCount'
        documentTypes:
          type: array
          description: Document types associated with this workspace
          items:
            $ref: '#/components/schemas/properties-identifier'
        rejectInvalidDocuments:
          type: boolean
          description: If true, the uploaded document will be rejected if it's of the wrong document type, or if its document type cannot be determined. No credits will be consumed.
        rejectDuplicates:
          $ref: '#/components/schemas/RejectDuplicates'
        members:
          type: array
          items:
            $ref: '#/components/schemas/User'
        unvalidatedDocsCount:
          type: integer
          minimum: 0
          description: Number of unvalidated documents in the workspace.
        confirmedDocsCount:
          type: integer
          minimum: 0
          description: Number of validated documents in the workspace.
        ingestEmail:
          type: string
          description: When you send email to this address, any document attached in the body will be uploaded to this workspace.
        whitelistIngestAddresses:
          type: array
          nullable: true
          description: If specified, only emails from these addresses will be ingested for parsing. Wild cards are allowed, e.g. "*@eyefind.info".
          items:
            type: string
            example: '*@eyefind.info'
        documentSplitter:
          $ref: '#/components/schemas/WorkspaceDocumentSplitter'
          nullable: true
    WorkspaceVisibility:
      type: string
      enum:
      - organization
      - private
      description: Visibility "organization" means everyone in the organization can access the workspace. Visibility "private" means only people explicitly added can access the workspace.
      example: organization
    confirmedDocsCount:
      type: integer
      nullable: true
      minimum: 0
      description: Number of validated documents in the collection.
    name:
      type: string
    WorkspaceMembership_properties-identifier:
      type: string
      description: Uniquely identify a membership.
      example: mEFayXdO
    User:
      type: object
      properties:
        id:
          type: integer
          description: Uniquely identify a user.
          example: 1
          minimum: 1
        name:
          type: string
          example: Carl Johnson
        username:
          type: string
          example: carljohnson
        email:
          type: string
          example: carljohnson@grove.street
        avatar:
          type: string
          nullable: true
          description: URL of the user's avatar.
          example: https://affinda-api.s3.amazonaws.com/media/user-avatar.png?AWSAccessKeyId=KEY&Signature=SIG
    validatable:
      type: boolean
    unvalidatedDocsCount:
      type: integer
      nullable: true
      minimum: 0
      description: Number of unvalidated documents in the collection.
    RejectDuplicates:
      type: boolean
      description: If "true", parsing will fail when the uploaded document is duplicate of an existing document, no credits will be consumed. If "false", will parse the document normally whether its a duplicate or not. If not provided, will fallback to the workspace settings.
      example: true
      nullable: true
    Extractor_properties-identifier:
      type: string
      description: Uniquely identify an extractor.
      example: resume
    Organization:
      type: object
      properties:
        identifier:
          type: string
          description: Uniquely identify an organization.
          example: mEFayXdO
        name:
          type: string
          example: Grove Street King
        userRole:
          type: string
          allOf:
          - $ref: '#/components/schemas/OrganizationRole'
          nullable: true
          description: The role of the logged in user within the organization.
        avatar:
          type: string
          nullable: true
          description: URL of the organization's avatar.
          example: https://affinda-api.s3.amazonaws.com/media/org-avatar.png?AWSAccessKeyId=KEY&Signature=SIG
        resthookSignatureKey:
          type: string
          nullable: true
          description: Used to sign webhook payloads so you can verify their integrity.
          example: 465c6598bd34c0558f0ce256c43209d49fa85b0ff3e4c18b24e408b7563143ad
        isTrial:
          type: boolean
        validationToolConfig:
          type: object
          nullable: true
          description: Configuration of the embeddable validation tool.
          properties:
            theme:
              $ref: '#/components/schemas/ThemeConfig'
            hideActions:
              type: boolean
              description: Hide the confirm document button and other actions.
            hideCollection:
              type: boolean
              description: Hide the collection selector.
            hideEditPages:
              type: boolean
              description: Hide the edit pages button.
            hideExport:
              type: boolean
              description: Hide the export menu.
            hideFilename:
              type: boolean
              description: Hide the filename input.
            hideShowRawValues:
              type: boolean
              description: Hide the toggle for showing raw annotation values.
            hideReject:
              type: boolean
              description: Hide the reject document button.
            hideReparse:
              type: boolean
              description: Hide the reparse button.
            hideRunOcr:
              type: boolean
              description: Hide the run OCR button.
            hideTags:
              type: boolean
              description: Hide the tags editor.
            hideWarnings:
              type: boolean
              description: Hide the warnings panel.
            restrictDocumentSplitting:
              type: boolean
              description: Disable the page editor after a document has been split once.
            disableCurrencyFormatting:
              type: boolean
              description: Disable currency formatting of decimals values.
            disableEditDocumentMetadata:
              type: boolean
              description: Disable editing document metadata. Makes the collection selector, filename input and tags editor read only.
            disableManualAnnotationEditing:
              type: boolean
              description: Disable manual editing of annotation values via the validation popover.
            hideDocumentStatus:
              type: boolean
              description: Hide the document status indicator in the toolbar.
        showCustomFieldCreation:
          type: boolean
          description: Whether to show the custom field creation in the UI.
    PaletteColorOptions:
      type: object
      required:
      - main
      properties:
        main:
          type: string
        light:
          type: string
        dark:
          type: string
        contrastText:
          type: string
    isCustom:
      type: boolean
    WorkspaceMembershipCreate:
      type: object
      properties:
        workspace:
          $ref: '#/components/schemas/identifier'
        user:
          $ref: '#/components/schemas/properties-id'
    WorkspaceDocumentSplitter:
      type: object
      required:
      - identifier
      - name
      properties:
        identifier:
          $ref: '#/components/schemas/DocumentSplitter_properties-identifier'
        name:
          $ref: '#/components/schemas/name'
  parameters:
    limitParam:
      in: query
      name: limit
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 100
        example: 20
      description: The numbers of results to return.
      x-ms-parameter-location: method
    offsetParam:
      in: query
      name: offset
      required: false
      schema:
        type: integer
        minimum: 0
        example: 0
      description: The number of documents to skip before starting to collect the result set.
      x-ms-parameter-location: method
  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).'