- Home
- API reference
- API documentation (JSON/XML)
- Tasks
- Contact document tasks
Contact document create (upload)
Function
The ContactDocumentCreate task task creates a new document for a specific document type and assigns it to a contact.
There can be only one document per document type per contact.
If another document is uploaded for the same document type and contact, it will be overwritten for JSON. With XML it is not overwritten automatically. Here the key override must be specified.
Description
Route: POST /contact/{id}/document/{type}
Content-Type: multipart/form-data
form: file=temp/data.pdf{
"stid": "20210520-app-4215",
"status": {
"code": "S0361",
"text": "The document for the contact has been successfully stored.",
"type": "SUCCESS"
},
"object": {
"type": "ContactDocument",
"value": "1",
"data": {
"contact": {
"id": 45637
},
"document": {
"id": 15234
},
"type": "ID_CARD"
}
}
}
Task code 0361
Uses ContactDocument object
<?xml version="1.0" encoding="utf-8"?>
<request>
<auth>
<user>customer</user>
<password>password</password>
<context>4</context>
</auth>
<task>
<code>0361</code>
<contact_document>
<contact>
<id>45637</id>
</contact>
<type>IDCARD</type>
<document>
<data><![CDATA[PGNvbnRlbn ... FDQT==]]></data>
</document>
</contact_document>
<key>override</key>
</task>
</request><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<response>
<result>
<data/>
<status>
<code>S0361</code>
<text>The document for the contact has been successfully stored.</text>
<type>success</type>
<object>
<type>contact_document</type>
<value>6556</value>
</object>
</status>
</result>
<stid>20210520-app-6442</stid>
</response>
cURL example
curl --location --request POST 'https://api.autodns.com/v1/contact/12345678/document/ID_CARD' --header 'X-Domainrobot-Context: 4' --user username:password --form 'file=@example.png;type=image/png'