PATCH
/
v3
/
documents
/
{identifier}
Update a document
curl --request PATCH \
  --url https://{region}.affinda.com/v3/documents/{identifier} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "collection": "mEFayXdO",
  "workspace": "mEFayXdO",
  "documentType": "<string>",
  "fileName": "Document.pdf",
  "expiryTime": "2023-11-07T05:31:56Z",
  "isConfirmed": true,
  "isRejected": true,
  "isArchived": true,
  "skipParse": true,
  "language": "en",
  "identifier": "<string>",
  "customIdentifier": "<string>",
  "warningMessages": [
    {
      "warningCode": "too_many_pages",
      "warningDetail": "File exceeds maximum number of pages allowed, parsing the first 10 pages only."
    }
  ]
}'
{
  "data": {},
  "extractor": "<string>",
  "meta": {
    "identifier": "<string>",
    "customIdentifier": "46ab8b02-0e5b-420c-877c-8b678d46a834",
    "fileName": "Document.pdf",
    "ready": true,
    "readyDt": "2020-12-10T01:43:32.276724Z",
    "failed": false,
    "expiryTime": "2023-11-07T05:31:56Z",
    "language": "en",
    "pdf": "https://affinda-api.s3.amazonaws.com/media/documents/Document.pdf?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062",
    "parentDocument": {
      "identifier": "<string>",
      "customIdentifier": "46ab8b02-0e5b-420c-877c-8b678d46a834"
    },
    "childDocuments": [
      {
        "identifier": "<string>",
        "customIdentifier": "46ab8b02-0e5b-420c-877c-8b678d46a834"
      }
    ],
    "pages": [
      {
        "id": 2,
        "pageIndex": 0,
        "image": "https://affinda-api.s3.amazonaws.com/media/pages/Page.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062",
        "imageTranslated": "https://affinda-api.s3.amazonaws.com/media/pages/PageTranslated.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062",
        "height": 700,
        "width": 500,
        "rotation": 90
      }
    ],
    "isOcrd": true,
    "ocrConfidence": 123,
    "reviewUrl": "<string>",
    "documentType": "<string>",
    "collection": {
      "identifier": "mEFayXdO",
      "name": "<string>",
      "extractor": {
        "identifier": "resume",
        "name": "<string>",
        "baseExtractor": "<string>",
        "validatable": true
      },
      "validationRules": [
        {
          "slug": "supplier_name_is_alphanumeric",
          "dataPoints": [
            "<string>"
          ]
        }
      ],
      "autoRefreshValidationResults": true
    },
    "workspace": {
      "identifier": "mEFayXdO",
      "name": "<string>"
    },
    "archivedDt": "2023-11-07T05:31:56Z",
    "isArchived": true,
    "skipParse": true,
    "confirmedDt": "2023-11-07T05:31:56Z",
    "confirmedBy": {
      "id": 1,
      "name": "Carl Johnson",
      "username": "carljohnson",
      "email": "carljohnson@grove.street",
      "avatar": "https://affinda-api.s3.amazonaws.com/media/user-avatar.png?AWSAccessKeyId=KEY&Signature=SIG"
    },
    "isConfirmed": true,
    "rejectedDt": "2023-11-07T05:31:56Z",
    "rejectedBy": {
      "id": 1,
      "name": "Carl Johnson",
      "username": "carljohnson",
      "email": "carljohnson@grove.street",
      "avatar": "https://affinda-api.s3.amazonaws.com/media/user-avatar.png?AWSAccessKeyId=KEY&Signature=SIG"
    },
    "archivedBy": {
      "id": 1,
      "name": "Carl Johnson",
      "username": "carljohnson",
      "email": "carljohnson@grove.street",
      "avatar": "https://affinda-api.s3.amazonaws.com/media/user-avatar.png?AWSAccessKeyId=KEY&Signature=SIG"
    },
    "isRejected": true,
    "createdDt": "2023-11-07T05:31:56Z",
    "errorCode": "document_conversion_failed",
    "errorDetail": "Unable to convert word document",
    "file": "<string>",
    "html": "<string>",
    "tags": [
      {
        "id": 1,
        "name": "<string>",
        "workspace": "mEFayXdO",
        "documentCount": 1
      }
    ],
    "createdBy": {
      "id": 1,
      "name": "Carl Johnson",
      "username": "carljohnson",
      "email": "carljohnson@grove.street",
      "avatar": "https://affinda-api.s3.amazonaws.com/media/user-avatar.png?AWSAccessKeyId=KEY&Signature=SIG"
    },
    "sourceEmail": "<string>",
    "sourceEmailAddress": "<string>",
    "regionBias": {
      "country": "<string>",
      "countries": [
        "<string>"
      ],
      "squareCoordinates": [
        123
      ],
      "strict": true
    }
  },
  "error": {
    "errorCode": "document_conversion_failed",
    "errorDetail": "Unable to convert word document"
  },
  "warnings": [
    {
      "warningCode": "too_many_pages",
      "warningDetail": "File exceeds maximum number of pages allowed, parsing the first 10 pages only."
    }
  ]
}

Authorizations

Authorization
string
header
required

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. You can obtain an API key by signing up for a free trial.

Path Parameters

identifier
string
required

Document's identifier

Query Parameters

compact
boolean

If "true", the response is compacted to annotations' parsed data. Annotations' meta data are excluded. Default is "false".

snake_case
boolean

Whether to return the response in snake_case instead of camelCase. Default is false.

Body

application/json

Document data to update

collection
string

Uniquely identify a collection.

Example:

"mEFayXdO"

workspace
string

Uniquely identify a workspace.

Example:

"mEFayXdO"

documentType
string | null

The document type's identifier. Provide if you already know the document type.

fileName
string | null

Optional filename of the file

Example:

"Document.pdf"

expiryTime
string<date-time> | null

The date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry.

isConfirmed
boolean
isRejected
boolean
isArchived
boolean
skipParse
boolean
language
string | null

Language code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese.

Example:

"en"

identifier
string
deprecated

Deprecated in favor of customIdentifier.

customIdentifier
string

Specify a custom identifier for the document if you need one, not required to be unique.

warningMessages
object[]

Response

Successfully updated document data.

extractor
string
required
meta
object
required
data
object
error
object
warnings
object[]