Skip to main content
POST
/
v3
/
documents
/
create_from_data
Create a document from raw data
curl --request POST \
  --url https://{region}.affinda.com/v3/documents/create_from_data \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "data": {
    "name": {
      "raw": "Tim A. Smith",
      "first": "Tim",
      "last": "Smith",
      "middle": "A.",
      "title": "Dr"
    },
    "phoneNumbers": [
      "(704) 996-9966",
      "+61412632636"
    ],
    "phoneNumberDetails": [
      {
        "rawText": "+61412632636",
        "formattedNumber": "+61 412 632 636",
        "countryCode": "AU",
        "internationalCountryCode": 61,
        "nationalNumber": "0412 632 636"
      }
    ],
    "websites": [
      "www.timsmith.com"
    ],
    "emails": [
      "timsmith@vt.edu"
    ],
    "dateOfBirth": "1992-01-01",
    "location": {
      "rawInput": "Blacksburg, VA"
    },
    "objective": "",
    "languages": [
      "English",
      "French",
      "Arabic"
    ],
    "summary": "",
    "totalYearsExperience": 13,
    "education": [
      {
        "id": 2,
        "organization": "Virginia Polytechnic Institute and State University (Virginia Tech)",
        "accreditation": {
          "education": "Bachelor of Science"
        },
        "grade": {
          "raw": "GPA : 3.35",
          "metric": "GPA",
          "value": "3.35"
        },
        "location": {
          "rawInput": "Blacksburg, VA"
        },
        "dates": {
          "completionDate": "2021-05-01",
          "isCurrent": true,
          "startDate": "2019-05-01",
          "rawText": "May-Aug '18"
        }
      }
    ],
    "workExperience": [
      {
        "id": 2,
        "jobTitle": "Sales and retail assistants",
        "organization": "General Motors",
        "location": {
          "rawInput": "Blacksburg, VA"
        },
        "jobDescription": "Interned with supercar Development from May 2017 to August 2017.",
        "dates": {
          "startDate": "2018-05-01",
          "endDate": "2018-08-01",
          "monthsInPosition": 1,
          "isCurrent": true,
          "rawText": "May-Aug '18"
        }
      }
    ],
    "skills": [
      {
        "id": 2,
        "name": "Applied Mechanics",
        "lastUsed": "2012-01-01",
        "numberOfMonths": 12
      }
    ],
    "certifications": [
      "Certificate in AWS"
    ],
    "publications": [
      "Tim Smith et al., Investigations of nanoparticles in the pathology of the human eye, Cell 2014"
    ],
    "referees": [
      {
        "name": "Stephen Smith",
        "text": "Stephen Smith, Team Member/Mentor, Company Power Generation: stephen.smith@company.com",
        "email": "stephen.smith@company.com",
        "number": "+61490667215",
        "position": "Principal"
      }
    ],
    "rawText": "Christopher Nolan 3210 fake street '... <rest of resume text>'",
    "redactedText": "**** Objective: To obtain a job '... <rest of resume text>'"
  }
}
EOF
import requests

url = "https://{region}.affinda.com/v3/documents/create_from_data"

payload = { "data": {
"name": {
"raw": "Tim A. Smith",
"first": "Tim",
"last": "Smith",
"middle": "A.",
"title": "Dr"
},
"phoneNumbers": ["(704) 996-9966", "+61412632636"],
"phoneNumberDetails": [
{
"rawText": "+61412632636",
"formattedNumber": "+61 412 632 636",
"countryCode": "AU",
"internationalCountryCode": 61,
"nationalNumber": "0412 632 636"
}
],
"websites": ["www.timsmith.com"],
"emails": ["timsmith@vt.edu"],
"dateOfBirth": "1992-01-01",
"location": { "rawInput": "Blacksburg, VA" },
"objective": "",
"languages": ["English", "French", "Arabic"],
"summary": "",
"totalYearsExperience": 13,
"education": [
{
"id": 2,
"organization": "Virginia Polytechnic Institute and State University (Virginia Tech)",
"accreditation": { "education": "Bachelor of Science" },
"grade": {
"raw": "GPA : 3.35",
"metric": "GPA",
"value": "3.35"
},
"location": { "rawInput": "Blacksburg, VA" },
"dates": {
"completionDate": "2021-05-01",
"isCurrent": True,
"startDate": "2019-05-01",
"rawText": "May-Aug '18"
}
}
],
"workExperience": [
{
"id": 2,
"jobTitle": "Sales and retail assistants",
"organization": "General Motors",
"location": { "rawInput": "Blacksburg, VA" },
"jobDescription": "Interned with supercar Development from May 2017 to August 2017.",
"dates": {
"startDate": "2018-05-01",
"endDate": "2018-08-01",
"monthsInPosition": 1,
"isCurrent": True,
"rawText": "May-Aug '18"
}
}
],
"skills": [
{
"id": 2,
"name": "Applied Mechanics",
"lastUsed": "2012-01-01",
"numberOfMonths": 12
}
],
"certifications": ["Certificate in AWS"],
"publications": ["Tim Smith et al., Investigations of nanoparticles in the pathology of the human eye, Cell 2014"],
"referees": [
{
"name": "Stephen Smith",
"text": "Stephen Smith, Team Member/Mentor, Company Power Generation: stephen.smith@company.com",
"email": "stephen.smith@company.com",
"number": "+61490667215",
"position": "Principal"
}
],
"rawText": "Christopher Nolan 3210 fake street '... <rest of resume text>'",
"redactedText": "**** Objective: To obtain a job '... <rest of resume text>'"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
name: {raw: 'Tim A. Smith', first: 'Tim', last: 'Smith', middle: 'A.', title: 'Dr'},
phoneNumbers: ['(704) 996-9966', '+61412632636'],
phoneNumberDetails: [
{
rawText: '+61412632636',
formattedNumber: '+61 412 632 636',
countryCode: 'AU',
internationalCountryCode: 61,
nationalNumber: '0412 632 636'
}
],
websites: ['www.timsmith.com'],
emails: ['timsmith@vt.edu'],
dateOfBirth: '1992-01-01',
location: {rawInput: 'Blacksburg, VA'},
objective: '',
languages: ['English', 'French', 'Arabic'],
summary: '',
totalYearsExperience: 13,
education: [
{
id: 2,
organization: 'Virginia Polytechnic Institute and State University (Virginia Tech)',
accreditation: {education: 'Bachelor of Science'},
grade: {raw: 'GPA : 3.35', metric: 'GPA', value: '3.35'},
location: {rawInput: 'Blacksburg, VA'},
dates: {
completionDate: '2021-05-01',
isCurrent: true,
startDate: '2019-05-01',
rawText: 'May-Aug \'18'
}
}
],
workExperience: [
{
id: 2,
jobTitle: 'Sales and retail assistants',
organization: 'General Motors',
location: {rawInput: 'Blacksburg, VA'},
jobDescription: 'Interned with supercar Development from May 2017 to August 2017.',
dates: {
startDate: '2018-05-01',
endDate: '2018-08-01',
monthsInPosition: 1,
isCurrent: true,
rawText: 'May-Aug \'18'
}
}
],
skills: [{id: 2, name: 'Applied Mechanics', lastUsed: '2012-01-01', numberOfMonths: 12}],
certifications: ['Certificate in AWS'],
publications: [
'Tim Smith et al., Investigations of nanoparticles in the pathology of the human eye, Cell 2014'
],
referees: [
{
name: 'Stephen Smith',
text: 'Stephen Smith, Team Member/Mentor, Company Power Generation: stephen.smith@company.com',
email: 'stephen.smith@company.com',
number: '+61490667215',
position: 'Principal'
}
],
rawText: 'Christopher Nolan 3210 fake street \'... <rest of resume text>\'',
redactedText: '**** Objective: To obtain a job \'... <rest of resume text>\''
}
})
};

fetch('https://{region}.affinda.com/v3/documents/create_from_data', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
{
  "extractor": "<string>",
  "meta": {
    "identifier": "<string>",
    "pages": [
      {
        "id": 2,
        "pageIndex": 0,
        "image": "https://affinda-api.s3.amazonaws.com/media/pages/Page.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062",
        "height": 700,
        "width": 500,
        "rotation": 90,
        "imageTranslated": "https://affinda-api.s3.amazonaws.com/media/pages/PageTranslated.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062"
      }
    ],
    "workspace": {
      "identifier": "mEFayXdO",
      "name": "<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"
      }
    ],
    "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
    },
    "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>",
    "llmHint": "<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
    }
  },
  "data": {},
  "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."
    }
  ]
}
{
"extractor": "<string>",
"meta": {
"identifier": "<string>",
"pages": [
{
"id": 2,
"pageIndex": 0,
"image": "https://affinda-api.s3.amazonaws.com/media/pages/Page.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062",
"height": 700,
"width": 500,
"rotation": 90,
"imageTranslated": "https://affinda-api.s3.amazonaws.com/media/pages/PageTranslated.png?AWSAccessKeyId=KEY&Signature=SIG&Expires=1663302062"
}
],
"workspace": {
"identifier": "mEFayXdO",
"name": "<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"
}
],
"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
},
"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>",
"llmHint": "<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
}
},
"data": {},
"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."
}
]
}
{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}
{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}
{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}
{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}

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.

Query Parameters

snake_case
boolean

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

Body

application/json

Resume or job description data to create a document from

data
object
required

Create resume or job description directly from data.

Response

Only returned when wait=True, will return the created document

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