> ## Documentation Index
> Fetch the complete documentation index at: https://docs.affinda.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.affinda.com/feedback

```json
{
  "path": "/api-reference/search-&-match/update-a-documents-data",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Update a document's data

> Update data of a document.
Only applicable for resumes and job descriptions. For other document types, please use the `PATCH /annotations/{id}` endpoint or the `POST /annotations/batch_update` endpoint.



## OpenAPI

````yaml https://api.affinda.com/static/v3/api_spec.yaml post /v3/documents/{identifier}/update_data
openapi: 3.0.3
info:
  description: >-
    # Introduction

    Affinda uses the latest advancements in AI technology to rapidly process
    documents with better-than-human accuracy.

    This guide covers how to:

    * Extract structured data from a range of document types

    * Integrate our solutions into your platform

    * Manage users


    *Note: This API spec is for v3 of the API, the deprecated v2 documentation
    [can be found here](https://api.affinda.com/docs/v2)*


    > **Important: Use the correct API URL for your region.** Affinda is hosted
    across multiple instances. Make sure you are sending requests to the correct
    URL for your account:

    > | Instance | API Base URL |

    > |----------|-------------|

    > | **AUS / Global** | `https://api.affinda.com` |

    > | **US** | `https://api.us1.affinda.com` |

    > | **EU** | `https://api.eu1.affinda.com` |

    >

    > You can determine your instance from the URL you use to access the Affinda
    web app (e.g. `app.us1.affinda.com` means you are on the US instance). When
    using the "Try it" feature, select the matching region from the server
    dropdown.

    # Getting Started

    * Obtain an API key by [signing up for a
    free-trial](https://app.affinda.com/auth/register)

    * (Recommended) Download and install one of our client libraries: *
    [Python](https://github.com/affinda/affinda-python) : `pip install affinda`
    * [Javascript](https://github.com/affinda/affinda-typescript) : `npm install
    @affinda/affinda` * [.NET](https://github.com/affinda/affinda-dotnet):
    `dotnet add package Affinda.API` *
    [Java](https://github.com/affinda/affinda-java) - [maven
    repository](https://mvnrepository.com/artifact/com.affinda.api/affinda-api-client)

    * Without a client library, API requests via HTTP according to the API spec
    in this documentation
  version: v3
  title: Affinda API
  contact:
    email: contact@affinda.com
  license:
    name: MIT
    url: https://raw.githubusercontent.com/affinda/affinda-api-spec/master/LICENSE
  x-logo:
    url: https://api.affinda.com/static/documentation/affinda_logo.png
    backgroundColor: '#FFFFFF'
    altText: Affinda logo
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: Documents
    description: >
      Operations to upload documents for parsing.


      A document can be uploaded using `file` or `url`, one of these parameters
      must be provided.


      A document can be uploaded to a `workspace` or a `collection`, one of
      these parameters must also be provided.


      When uploaded to a workspace, the document's specific type will be
      predicted and auto classified into one of the collections before being
      parsed.


      When uploaded to a collection, the document will be parsed using that
      collection's extractor.
  - name: Organizations
    description: |
      Operations to manage organizations and organization memberships.

      Organizations are the top-level entity for managing users and workspaces.
  - name: Workspaces
    description: |
      Operations to manage workspaces.

      Workspaces group together related collections of documents.
  - name: Document Types
    description: >
      Operations to manage document types.


      Document types represent specific categories of documents with common
      extraction patterns, such as invoices or resumes.
  - name: Data Sources
    description: >
      Operations to manage custom mapping data sources. These are used to map
      from raw data extracted by

      Affinda AI models onto your own data model.
  - name: Validation Results
    description: >
      Operations to manage validation results.


      Validation results track the status and outcomes of document validation
      processes.
  - name: Usage
    description: >
      Operations to retrieve credits consumption.


      Returns daily credits usage for an organization, optionally narrowed to a
      single

      workspace or document type.
  - name: Tags
    description: >
      Operations to manage tags.


      Tags can be arbitrarily attached to documents to help organize and manage
      them.
  - name: Annotations
    description: >
      Operations to manually create, update, delete annotations.


      Together with the data point endpoints, these helps to annotate your
      documents with arbitrary data,

      or to edit annotations that were created by the Affinda parser.
  - name: Webhooks
    description: >
      Manage webhook integrations with your apps.


      Affinda have implemented webhooks to allow the data extracted by Affinda
      to be 'pushed' to you when an event occurs

      (e.g. document parsed or document validated), instead of you having to
      constantly poll our API to 'pull' the data to your system.
  - name: Search & Match
    description: >
      Operations to search through an index of documents and manage indexes via
      the Affinda Resume Parser API or a client library.


      Resumes and job descriptions must be explicitly added to an index, which
      then makes them searchable.
  - name: Deprecated End Points
    description: >
      Deprecated endpoints that are maintained for backward compatibility.


      These endpoints include Data Point, Collection, and Users functionality
      that has been superseded by newer APIs.
  - name: Add x-hidden to endpoints
    description: >
      Hidden endpoints not intended for public use.


      These endpoints include Splitting, Extractor, Organization, and Workspace
      Memberships & Usage functionality.
paths:
  /v3/documents/{identifier}/update_data:
    post:
      tags:
        - Search & Match
      summary: Update a document's data
      description: >-
        Update data of a document.

        Only applicable for resumes and job descriptions. For other document
        types, please use the `PATCH /annotations/{id}` endpoint or the `POST
        /annotations/batch_update` endpoint.
      operationId: updateDocumentData
      parameters:
        - in: path
          required: true
          name: identifier
          description: Resume or Job Description identifier
          schema:
            $ref: '#/components/schemas/Identifier'
      requestBody:
        description: Resume data to update
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/ResumeData'
                - $ref: '#/components/schemas/JobDescriptionDataUpdate'
      responses:
        '200':
          description: Successfully updated resume data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        default:
          $ref: '#/components/responses/DefaultError'
components:
  schemas:
    Identifier:
      type: string
      description: A random string that uniquely identify the resource.
    ResumeData:
      type: object
      additionalProperties:
        anyOf:
          - type: object
            nullable: true
          - type: string
            nullable: true
          - type: integer
            nullable: true
          - type: number
            nullable: true
          - type: boolean
            nullable: true
          - type: array
            items: {}
            description: >-
              For fields with multiple entries, use lists. E.g. 'multipleField':
              ['entry1', 'entry2']
            nullable: true
        description: 'For custom fields. E.g. ''isAvailable'': true'
        not:
          type: object
      nullable: true
      description: A JSON-encoded string of the `ResumeData` object.
      properties:
        name:
          type: object
          nullable: true
          additionalProperties: false
          properties:
            raw:
              type: string
              example: Tim A. Smith
            first:
              type: string
              example: Tim
            last:
              type: string
              example: Smith
            middle:
              type: string
              example: A.
            title:
              type: string
              example: Dr
        phoneNumbers:
          type: array
          items:
            type: string
          example:
            - (704) 996-9966
            - '+61412632636'
        phoneNumberDetails:
          type: array
          items:
            type: object
            properties:
              rawText:
                type: string
                nullable: false
                example: '+61412632636'
              formattedNumber:
                type: string
                nullable: true
                example: +61 412 632 636
              countryCode:
                type: string
                nullable: true
                example: AU
              internationalCountryCode:
                type: integer
                nullable: true
                example: 61
                minimum: 1
              nationalNumber:
                type: string
                nullable: true
                example: 0412 632 636
        websites:
          type: array
          items:
            type: string
          example:
            - www.timsmith.com
        emails:
          type: array
          items:
            type: string
            format: email
          example:
            - timsmith@vt.edu
        dateOfBirth:
          type: string
          example: '1992-01-01'
          nullable: true
        location:
          $ref: '#/components/schemas/Location'
        objective:
          type: string
          default: ''
          nullable: true
        languages:
          type: array
          items:
            type: string
            enum:
              - Ainu
              - Akan
              - Akkadian
              - Amharic
              - Anam
              - Arabic
              - Aramaic
              - Arem
              - Armenian
              - Awadhi
              - Aymara
              - Azari
              - Bagheli
              - Bagri
              - Bahasa
              - Bahasa Indonesian
              - Bambara
              - Bangala
              - Bardi
              - Bassa
              - Batak
              - Belarusian
              - Bemba
              - Benga
              - Bengali
              - Berber
              - Bhojpuri
              - Bislama
              - Brahui
              - Bulgarian
              - Bunu
              - Cambodian
              - Carew
              - Carib
              - Catalan
              - Cebuano
              - Chakma
              - Chamorro
              - Chango
              - Chewa
              - Croatian
              - Czech
              - Dagbani
              - Danish
              - Dari
              - Dayi
              - Dhatki
              - Dhivehi
              - Dinka
              - Dogri
              - Duala
              - Dutch
              - English
              - Esperanto
              - Estonian
              - Ewondo
              - Faroese
              - Filipino
              - Finnish
              - Formula
              - French
              - Frisian
              - Friulian
              - Fula
              - Gaelic
              - Galo
              - Garhwali
              - Garifuna
              - German
              - Gikuyu
              - Gujarati
              - Gujerati
              - Gwere
              - Hawaiian
              - Haya
              - Hebrew
              - Hindi
              - Hmu
              - Hokkien
              - Hopi
              - Hungarian
              - Hup
              - Ibanag
              - Igbo
              - Ilokano
              - Indonesian
              - Intermediate
              - Irish
              - Italian
              - Japanese
              - Jiba
              - Kachin
              - Kalenjin
              - Kamayo
              - Kannada
              - Kaonde
              - Kayan
              - Khandeshi
              - Khmer
              - Kikuyu
              - Kodava
              - Koma
              - Kongo
              - Konkani
              - Korean
              - Korwa
              - Kreyol
              - Krio
              - Kumaoni
              - Kurdish
              - Kurukh
              - Kwa
              - Ladino
              - Lango
              - Latvian
              - Lawa
              - Lingala
              - Lithuanian
              - Lule
              - Luxembourgish
              - Magahi
              - Maithili
              - Malay
              - Malayalam
              - Malaysian
              - Malvi
              - Maninka
              - Manipuri
              - Manx
              - Marathi
              - Mayan
              - Medumba
              - Memoni
              - Mewari
              - Mizo
              - Montenegrin
              - Mwan
              - Mwanga
              - Ndebele
              - Nepali
              - Nimadi
              - Oriya
              - Oromo
              - Ovambo
              - Pamona
              - Pangasinan
              - Pashto
              - Phoenician
              - Polish
              - Portuguese
              - Pulaar
              - Pular
              - Punjabi
              - Quecha
              - Rajasthani
              - Romanian
              - Russian
              - Sakha
              - Sango
              - Santhali
              - Saraiki
              - Seim
              - Shading
              - Shama
              - Shan
              - Shona
              - Silesian
              - Sindhi
              - Slovak
              - Slovene
              - Soga
              - Sogdian
              - Sotho
              - Spanish
              - Sudanese
              - Sumerian
              - Surajpuri
              - Surigaonon
              - Swati
              - Swazi
              - Swedish
              - Tagalog
              - Tamil
              - Tausug
              - Telugu
              - Tetum
              - Tharu
              - Tibetan
              - Tigrinya
              - Tripuri
              - Tswana
              - Tulu
              - Turkish
              - Tuwali
              - Ubi
              - Ukrainian
              - Urdu
              - Veps
              - Vietnamese
              - Wagdi
              - Waziri
              - Xhosa
              - Yiddish
              - Yoruba
          example:
            - English
            - French
            - Arabic
        languageCodes:
          type: array
          items:
            type: string
          readOnly: true
          example:
            - en
            - fr
            - ar
        summary:
          type: string
          default: ''
          nullable: true
        totalYearsExperience:
          type: integer
          example: 13
          nullable: true
          minimum: 0
        headShot:
          type: string
          format: byte
          nullable: true
          readOnly: true
          description: base64 encoded string
        education:
          type: array
          items:
            $ref: '#/components/schemas/Education'
        profession:
          type: string
          example: Software Developer
          description: >-
            Prediction of the candidate's profession based on recent work
            experience
          nullable: true
          readOnly: true
        linkedin:
          type: string
          example: https://www.linkedin.com/in/user-name
          description: Linkedin account associated with the candidate
          nullable: true
          readOnly: true
        workExperience:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              id:
                type: integer
                nullable: false
                minimum: 1
              jobTitle:
                type: string
                nullable: true
                example: Sales and retail assistants
              socCode:
                type: string
                nullable: true
                readOnly: true
                example: '7111'
              socName:
                type: string
                nullable: true
                readOnly: true
                example: Sales and retail assistants
              organization:
                type: string
                nullable: true
                example: General Motors
              industry:
                type: string
                nullable: true
                readOnly: true
                example: Automotive
              location:
                $ref: '#/components/schemas/Location'
              jobDescription:
                type: string
                nullable: true
                example: >-
                  Interned with supercar Development from May 2017 to August
                  2017.
              dates:
                type: object
                additionalProperties: false
                nullable: true
                properties:
                  startDate:
                    type: string
                    format: date
                    nullable: true
                    example: '2018-05-01'
                  endDate:
                    type: string
                    format: date
                    nullable: true
                    example: '2018-08-01'
                  monthsInPosition:
                    type: integer
                    nullable: true
                    minimum: 0
                  isCurrent:
                    type: boolean
                  rawText:
                    type: string
                    example: May-Aug '18
              occupation:
                type: object
                additionalProperties: false
                nullable: false
                readOnly: true
                properties:
                  jobTitle:
                    type: string
                    nullable: true
                    example: Sr. Software Developer
                    description: >-
                      The raw (not normalized) job title pulled from the work
                      experience entry
                  jobTitleNormalized:
                    type: string
                    example: Software Developer
                    nullable: true
                    description: >-
                      Mapped onto the EMSI job title taxonomy if a sufficiently
                      close match exists.
                  emsiId:
                    type: string
                    nullable: true
                    example: ETE2AD3A1C11B4EC9B
                    description: EMSI id of the normalised job title.
                  managementLevel:
                    $ref: '#/components/schemas/ManagementLevel'
                  classification:
                    type: object
                    additionalProperties: false
                    nullable: true
                    properties:
                      title:
                        type: string
                        example: Book-keepers, payroll managers and wages clerks
                        description: SOC2020 classification for this job title
                      minorGroup:
                        type: string
                        example: 'Administrative Occupations: Finance'
                        description: SOC2020 minor group
                      subMajorGroup:
                        type: string
                        example: ADMINISTRATIVE OCCUPATIONS
                        description: SOC2020 sub major group
                      majorGroup:
                        type: string
                        example: ADMINISTRATIVE AND SECRETARIAL OCCUPATIONS
                        description: SOC2020 major group
                      socCode:
                        type: integer
                        example: 4122
                        minimum: 1
                        maximum: 9999
                        description: >-
                          The 4 digit code representing the SOC2020
                          classification for this job title
                      minorGroupCode:
                        type: integer
                        example: 4122
                        minimum: 1
                        maximum: 9999
                        description: >-
                          The 4 digit code representing the SOC2020
                          classification for this job title
                      subMajorGroupCode:
                        type: integer
                        example: 4122
                        minimum: 1
                        maximum: 9999
                        description: >-
                          The 4 digit code representing the SOC2020
                          classification for this job title
                      majorGroupCode:
                        type: integer
                        example: 4122
                        minimum: 1
                        maximum: 9999
                        description: >-
                          The 4 digit code representing the SOC2020
                          classification for this job title
        skills:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              id:
                type: integer
                nullable: false
                minimum: 1
              emsiId:
                type: string
                nullable: true
                readOnly: true
                example: KS1218W78FGVPVP2KXPX
                description: EMSI id of this skill.
              name:
                type: string
                example: Applied Mechanics
              lastUsed:
                nullable: true
                type: string
                example: '2012-01-01'
              numberOfMonths:
                type: integer
                nullable: true
                example: 12
                minimum: 0
              type:
                type: string
                readOnly: true
                example: hard_skill
              count:
                type: integer
                nullable: true
                readOnly: true
                example: 16
                minimum: 0
              weighting:
                type: number
                nullable: true
                readOnly: true
                example: 0.057699221573302296
              sources:
                type: array
                readOnly: true
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    section:
                      type: string
                      example: WorkExperience
                    position:
                      type: integer
                      nullable: true
                      example: 0
                      description: >-
                        If this skill is extracted from a "workExperience"
                        section, the "position" is the index of the work
                        experience where this skill is found, with 0 being the
                        first work experience, 1 being the second work
                        experience, and so on.
                    workExperienceId:
                      type: integer
                      nullable: true
                      example: 1234
                      description: >-
                        If this skill is extracted from a "workExperience"
                        section, the "workExperienceId" is the id of the work
                        experience where this skill is found.
        certifications:
          type: array
          items:
            type: string
          example:
            - Certificate in AWS
        publications:
          type: array
          items:
            type: string
          example:
            - >-
              Tim Smith et al., Investigations of nanoparticles in the pathology
              of the human eye, Cell 2014
        referees:
          type: array
          items:
            type: object
            additionalProperties: true
            properties:
              name:
                type: string
                example: Stephen Smith
                nullable: true
              text:
                type: string
                example: >-
                  Stephen Smith, Team Member/Mentor, Company Power Generation:
                  stephen.smith@company.com
              email:
                type: string
                format: email
                example: stephen.smith@company.com
                nullable: true
              number:
                type: string
                example: '+61490667215'
                nullable: true
              position:
                type: string
                nullable: true
                example: Principal
        sections:
          type: array
          readOnly: true
          items:
            type: object
            additionalProperties: false
            properties:
              sectionType:
                type: string
                example: PersonalDetails
              bbox:
                type: array
                items:
                  type: number
                example:
                  - 0
                  - 36.392
                  - 612
                  - 111.056
                minItems: 4
                maxItems: 4
              pageIndex:
                type: integer
              text:
                type: string
                example: <All text from the {sectionType} section>
        isResumeProbability:
          type: integer
          readOnly: true
          nullable: true
          example: 98
          description: >-
            Probability that the given document is a resume. Values below 30
            suggest that the document is not a resume.
        rawText:
          type: string
          example: Christopher Nolan 3210 fake street '... <rest of resume text>'
          description: >-
            All of the raw text of the parsed resume, example is shortened for
            readability
        redactedText:
          type: string
          example: '**** Objective: To obtain a job ''... <rest of resume text>'''
          description: Redacted version of the text in the resume, removing PII.
    JobDescriptionDataUpdate:
      type: object
      additionalProperties:
        anyOf:
          - type: string
            nullable: true
          - type: integer
            nullable: true
          - type: number
            nullable: true
          - type: boolean
            nullable: true
          - type: array
            items: {}
            description: >-
              For fields with multiple entries, use lists. E.g. 'multipleField':
              ['entry1', 'entry2']
            nullable: true
        description: 'For custom fields. E.g. ''isAvailable'': true'
        not:
          type: object
      nullable: true
      description: A JSON-encoded string of the `JobDescriptionData` object.
      properties:
        jobTitle:
          $ref: '#/components/schemas/JobTitleAnnotationUpdate'
        contactEmail:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        contactName:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        contactPhone:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        startDate:
          $ref: '#/components/schemas/DateAnnotationUpdate'
        endDate:
          $ref: '#/components/schemas/DateAnnotationUpdate'
        jobType:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        languages:
          type: array
          items:
            $ref: '#/components/schemas/LanguageAnnotationUpdate'
        skills:
          type: array
          items:
            $ref: '#/components/schemas/SkillAnnotationUpdate'
        organizationName:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        organizationWebsite:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        educationLevel:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        educationAccreditation:
          $ref: '#/components/schemas/TextAnnotationUpdate'
        expectedRemuneration:
          $ref: '#/components/schemas/ExpectedRemunerationAnnotationUpdate'
        location:
          $ref: '#/components/schemas/LocationAnnotationUpdate'
        certifications:
          type: array
          items:
            $ref: '#/components/schemas/TextAnnotationUpdate'
        yearsExperience:
          $ref: '#/components/schemas/YearsExperienceAnnotationUpdate'
      x-csharp-usage: output
    Document:
      type: object
      required:
        - meta
        - extractor
      properties:
        data:
          type: object
        extractor:
          type: string
        meta:
          $ref: '#/components/schemas/DocumentMeta'
        error:
          $ref: '#/components/schemas/DocumentError'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DocumentWarning'
      discriminator:
        propertyName: extractor
      x-csharp-usage: input,output
    Location:
      type: object
      nullable: true
      required:
        - rawInput
      properties:
        formatted:
          type: string
          nullable: true
          readOnly: true
          example: Blacksburg, VA, USA
        postalCode:
          type: string
          readOnly: true
          example: '3124'
          nullable: true
        state:
          type: string
          readOnly: true
          nullable: true
          example: Virginia
        stateCode:
          type: string
          nullable: true
          readOnly: true
          example: TX
        country:
          type: string
          readOnly: true
          nullable: true
          example: United States
        countryCode:
          type: string
          nullable: true
          readOnly: true
          example: US
          description: Two letter country code (ISO 3166-1 alpha-2)
        rawInput:
          type: string
          example: Blacksburg, VA
        streetNumber:
          type: string
          nullable: true
          readOnly: true
          example: '1'
        street:
          type: string
          nullable: true
          readOnly: true
          example: Smith St
        apartmentNumber:
          type: string
          nullable: true
          readOnly: true
          example: '12'
        city:
          type: string
          nullable: true
          readOnly: true
          example: Blacksburg
        latitude:
          type: number
          nullable: true
          readOnly: true
          example: '67.0124'
        longitude:
          type: number
          nullable: true
          readOnly: true
          example: '67.0124'
        poBox:
          type: string
          nullable: true
          readOnly: true
          example: P.O. Box 123
    Education:
      type: object
      properties:
        id:
          type: integer
          nullable: false
          minimum: 1
        organization:
          type: string
          nullable: true
          example: Virginia Polytechnic Institute and State University (Virginia Tech)
        accreditation:
          $ref: '#/components/schemas/Accreditation'
        grade:
          type: object
          additionalProperties: true
          nullable: true
          properties:
            raw:
              type: string
              example: 'GPA : 3.35'
            metric:
              type: string
              example: GPA
              nullable: true
            value:
              type: string
              example: '3.35'
        location:
          $ref: '#/components/schemas/Location'
        dates:
          type: object
          nullable: true
          additionalProperties: false
          properties:
            completionDate:
              type: string
              format: date
              example: '2021-05-01'
            isCurrent:
              type: boolean
            startDate:
              type: string
              format: date
              nullable: true
              example: '2019-05-01'
            rawText:
              type: string
              example: May-Aug '18
    ManagementLevel:
      type: string
      example: Low
      nullable: true
      enum:
        - None
        - Low
        - Mid
        - Upper
      x-ms-enum:
        name: managementLevel
    JobTitleAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - $ref: '#/components/schemas/JobTitleParsed'
    TextAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              type: string
              nullable: true
              example: John Smith
    DateAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              type: string
              format: date
              nullable: true
              example: '2022-02-09'
    LanguageAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              type: string
              readOnly: true
              nullable: true
              example: Mandarin Chinese
    SkillAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              type: string
              readOnly: true
              nullable: true
              example: Basket weaving
    ExpectedRemunerationAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              type: object
              properties:
                minimum:
                  type: number
                  nullable: true
                  example: '3455343.50'
                maximum:
                  type: number
                  nullable: true
                  example: '55545343.50'
                currency:
                  type: string
                  nullable: true
                  example: USD
                unit:
                  type: string
                  nullable: true
                  example: Annually
    LocationAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              readOnly: true
              allOf:
                - $ref: '#/components/schemas/Location'
    YearsExperienceAnnotationUpdate:
      type: object
      nullable: true
      allOf:
        - $ref: '#/components/schemas/AnnotationBase'
        - type: object
          properties:
            parsed:
              type: object
              description: Years of experience range
              properties:
                minimum:
                  type: number
                  nullable: true
                  description: Minimum years of experience
                  example: 0.5
                maximum:
                  type: number
                  nullable: true
                  description: Maximum years of experience
                  example: 5
    DocumentMeta:
      type: object
      required:
        - identifier
        - pages
        - workspace
      properties:
        identifier:
          type: string
          description: Unique identifier for the document
        customIdentifier:
          type: string
          nullable: true
          description: >-
            Optional identifier for the document that you can set to track the
            document in the Affinda system.  Is not required to be unique.
          example: 46ab8b02-0e5b-420c-877c-8b678d46a834
        fileName:
          $ref: '#/components/schemas/FileName'
        ready:
          type: boolean
          nullable: false
          example: true
          description: >-
            If true, the document has finished processing. Particularly useful
            if an endpoint request specified wait=False, when polling use this
            variable to determine when to stop polling
        readyDt:
          type: string
          format: date-time
          example: '2020-12-10T01:43:32.276724Z'
          nullable: true
          description: The datetime when the document was ready
        failed:
          type: boolean
          nullable: false
          example: false
          description: >-
            If true, some exception was raised during processing. Check the
            'error' field of the main return object.
        expiryTime:
          $ref: '#/components/schemas/ExpiryTime'
        language:
          type: string
          nullable: true
          example: en
          description: The document's language.
        pdf:
          type: string
          nullable: true
          example: >-
            https://affinda-api.s3.amazonaws.com/media/documents/Document.pdf?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062
          description: >-
            The URL to the document's pdf (if the uploaded document is not
            already pdf, it's converted to pdf as part of the parsing process).
        parentDocument:
          type: object
          nullable: true
          description: >-
            If this document is part of a splitted document, this attribute
            points to the original document that this document is splitted from.
          properties:
            identifier:
              $ref: '#/components/schemas/DocumentMeta_properties-identifier'
            customIdentifier:
              $ref: '#/components/schemas/customIdentifier'
        childDocuments:
          type: array
          description: >-
            If this document has been splitted into a number of child documents,
            this attribute points to those child documents.
          items:
            type: object
            properties:
              identifier:
                $ref: '#/components/schemas/DocumentMeta_properties-identifier'
              customIdentifier:
                $ref: '#/components/schemas/customIdentifier'
        pages:
          type: array
          items:
            $ref: '#/components/schemas/PageMeta'
          description: The document's pages.
        isOcrd:
          type: boolean
        ocrConfidence:
          type: number
          nullable: true
        reviewUrl:
          type: string
          nullable: true
        documentType:
          type: string
          description: >-
            The document type's identifier.  Provide if you already know the
            document type.
          nullable: true
        collection:
          type: object
          nullable: true
          required:
            - identifier
          properties:
            identifier:
              $ref: '#/components/schemas/properties-identifier'
            name:
              $ref: '#/components/schemas/name'
            extractor:
              type: object
              nullable: true
              properties:
                identifier:
                  $ref: '#/components/schemas/Extractor_properties-identifier'
                name:
                  $ref: '#/components/schemas/name'
                baseExtractor:
                  type: string
                  description: Base extractor's identifier.
                  nullable: true
                validatable:
                  $ref: '#/components/schemas/validatable'
            validationRules:
              type: array
              items:
                $ref: '#/components/schemas/ValidationRule'
            autoRefreshValidationResults:
              type: boolean
              description: >-
                If True, validation results are refreshed whenever annotations
                are changed.
        workspace:
          type: object
          required:
            - identifier
          properties:
            identifier:
              $ref: '#/components/schemas/identifier'
            name:
              $ref: '#/components/schemas/name'
        archivedDt:
          type: string
          format: date-time
          nullable: true
        isArchived:
          type: boolean
        skipParse:
          type: boolean
        confirmedDt:
          type: string
          format: date-time
          nullable: true
        confirmedBy:
          $ref: '#/components/schemas/UserNullable'
        isConfirmed:
          type: boolean
        rejectedDt:
          type: string
          format: date-time
          nullable: true
        rejectedBy:
          $ref: '#/components/schemas/UserNullable'
        archivedBy:
          $ref: '#/components/schemas/UserNullable'
        isRejected:
          type: boolean
        createdDt:
          type: string
          format: date-time
        errorCode:
          $ref: '#/components/schemas/errorCode'
        errorDetail:
          $ref: '#/components/schemas/errorDetail'
        file:
          type: string
          nullable: true
          description: URL to view the file.
        html:
          type: string
          nullable: true
          description: URL to view the file converted to HTML.
        llmHint:
          type: string
          nullable: true
          description: >-
            Optional hint inserted into the LLM prompt when processing this
            document.
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        createdBy:
          $ref: '#/components/schemas/User'
        sourceEmail:
          type: string
          nullable: true
          description: >-
            If the document is created via email ingestion, this field stores
            the email file's URL.
        sourceEmailAddress:
          type: string
          nullable: true
          description: >-
            If the document is created via email ingestion, this field stores
            the email's From address.
        regionBias:
          $ref: '#/components/schemas/RegionBias'
    DocumentError:
      type: object
      additionalProperties: false
      properties:
        errorCode:
          type: string
          nullable: true
          example: document_conversion_failed
        errorDetail:
          type: string
          nullable: true
          example: Unable to convert word document
    DocumentWarning:
      type: object
      additionalProperties: false
      properties:
        warningCode:
          type: string
          nullable: true
          example: too_many_pages
        warningDetail:
          type: string
          nullable: true
          example: >-
            File exceeds maximum number of pages allowed, parsing the first 10
            pages only.
    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
    Accreditation:
      type: object
      nullable: true
      additionalProperties: false
      properties:
        education:
          type: string
          example: Bachelor of Science
        inputStr:
          type: string
          readOnly: true
          example: Bachelor of Science, Mechanical Engineering, expected
        matchStr:
          type: string
          nullable: true
          readOnly: true
          example: Bachelor of Science
        educationLevel:
          type: string
          nullable: true
          readOnly: true
          example: bachelors
    AnnotationBase:
      type: object
      additionalProperties: true
      nullable: true
      properties:
        id:
          type: integer
        rectangle:
          $ref: '#/components/schemas/Rectangle'
          nullable: true
        rectangles:
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/Rectangle'
          nullable: true
        pageIndex:
          type: integer
          nullable: true
          example: 0
        raw:
          type: string
          nullable: true
          example: 2/9/2022
        confidence:
          type: number
          nullable: true
          example: 0.86
          description: The overall confidence that the model's prediction is correct
        classificationConfidence:
          type: number
          nullable: true
          example: 0.95
          description: The model's confidence that the text has been classified correctly
        textExtractionConfidence:
          type: number
          nullable: true
          example: 0.9
          description: >-
            If the document was submitted as an image, this is the confidence
            that the text in the image has been correctly read by the model.
        isVerified:
          type: boolean
        isClientVerified:
          type: boolean
        isAutoVerified:
          type: boolean
        dataPoint:
          type: string
        contentType:
          type: string
    JobTitleParsed:
      type: object
      properties:
        parsed:
          type: object
          nullable: true
          description: Matching job title to extracted text
          readOnly: true
          properties:
            name:
              type: string
              nullable: true
            managementLevel:
              type: string
              nullable: true
              example: Mid
            classification:
              type: object
              nullable: true
              properties:
                socCode:
                  type: number
                  example: 2463
                title:
                  type: string
                  example: Clergy
                minorGroup:
                  type: string
                  example: Welfare Professionals
                subMajorGroup:
                  type: string
                  example: BUSINESS, MEDIA AND PUBLIC SERVICE PROFESSIONALS
                majorGroup:
                  type: string
                  example: PROFESSIONAL OCCUPATIONS
                minorGroupCode:
                  type: integer
                  example: 4122
                  description: >-
                    The 4 digit code representing the SOC2020 classification for
                    this job title
                subMajorGroupCode:
                  type: integer
                  example: 4122
                  description: >-
                    The 4 digit code representing the SOC2020 classification for
                    this job title
                majorGroupCode:
                  type: integer
                  example: 4122
                  description: >-
                    The 4 digit code representing the SOC2020 classification for
                    this job title
    FileName:
      type: string
      nullable: true
      description: Optional filename of the file
      example: Document.pdf
    ExpiryTime:
      type: string
      nullable: true
      format: date-time
      description: >-
        The date/time in ISO-8601 format when the document will be automatically
        deleted.  Defaults to no expiry.
    DocumentMeta_properties-identifier:
      type: string
      description: Unique identifier for the document
    customIdentifier:
      type: string
      nullable: true
      description: >-
        Optional identifier for the document that you can set to track the
        document in the Affinda system.  Is not required to be unique.
      example: 46ab8b02-0e5b-420c-877c-8b678d46a834
    PageMeta:
      type: object
      required:
        - id
        - pageIndex
        - image
        - width
        - height
        - rotation
      properties:
        id:
          type: integer
          minimum: 1
        pageIndex:
          type: integer
          example: 0
          minimum: 0
          description: Page number within the document, starts from 0.
        image:
          type: string
          nullable: true
          example: >-
            https://affinda-api.s3.amazonaws.com/media/pages/Page.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062
          description: The URL to the image of the page.
        imageTranslated:
          type: string
          nullable: true
          example: >-
            https://affinda-api.s3.amazonaws.com/media/pages/PageTranslated.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062
          description: The URL to the translated image of the page.
        height:
          type: number
          example: 700
          description: Height of the page's image in px.
        width:
          type: number
          example: 500
          description: Width of the page's image in px.
        rotation:
          type: integer
          example: 90
          minimum: -360
          maximum: 360
          description: >-
            The degree of rotation applied to the page. Greater than 0 indicates
            clockwise rotation. Less than 0 indicates counter-clockwise
            rotation.
    properties-identifier:
      type: string
      description: Uniquely identify a collection.
      example: mEFayXdO
    name:
      type: string
    Extractor_properties-identifier:
      type: string
      description: Uniquely identify an extractor.
      example: resume
    validatable:
      type: boolean
    ValidationRule:
      type: object
      additionalProperties: false
      nullable: false
      description: A validation rule for a collection
      required:
        - slug
        - dataPoints
      properties:
        slug:
          type: string
          description: The slug of the validation rule, in lowercase snake_case
          pattern: ^[a-z0-9_]+$
          example: supplier_name_is_alphanumeric
        dataPoints:
          type: array
          description: >-
            The data point identifier that this validation rule applies to, can
            be an empty list if the rule doens't use any data points as sources
          items:
            $ref: '#/components/schemas/Identifier'
    identifier:
      type: string
      description: Uniquely identify a workspace.
      example: mEFayXdO
    UserNullable:
      type: object
      nullable: true
      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
    errorCode:
      type: string
      nullable: true
      example: document_conversion_failed
    errorDetail:
      type: string
      nullable: true
      example: Unable to convert word document
    Tag:
      type: object
      required:
        - id
        - name
        - workspace
        - documentCount
      properties:
        id:
          type: integer
          description: Uniquely identify a tag.
          example: 1
          minimum: 1
        name:
          type: string
        workspace:
          $ref: '#/components/schemas/identifier'
        documentCount:
          type: integer
          minimum: 0
          description: Number of documents tagged with this.
    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
    RegionBias:
      type: object
      nullable: true
      properties:
        country:
          type: string
          nullable: true
          description: >-
            A single alpha-2 country code (e.g. AU) used by google geocoding
            service
        countries:
          type: array
          items:
            type: string
          nullable: true
          description: A list of alpha-2 country codes used by Pelias
        squareCoordinates:
          type: array
          items:
            type: number
          nullable: true
          description: >-
            A list of coordinates used by Pelias in the shape of [min_lon,
            min_lat, max_lon, max_lat]
        strict:
          type: boolean
          description: >
            If true, the location must be within the region, as opposed to
            prefering locations within the region.

            Default to false.
          example: true
    Rectangle:
      type: object
      additionalProperties: false
      nullable: false
      required:
        - x0
        - y0
        - x1
        - y1
      properties:
        pageIndex:
          type: integer
          nullable: false
          example: 1
          minimum: 0
        x0:
          type: number
          nullable: false
          example: 2.43
        y0:
          type: number
          nullable: false
          example: 4.55
        x1:
          type: number
          nullable: false
          example: 4.56
        y1:
          type: number
          nullable: false
          example: 6.32
  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
    401Error:
      description: Authorisation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      x-ms-error-response: true
    DefaultError:
      description: UnexpectedError
      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).

````