Documents

This resource corresponds to a digitized document hosted on Public Mint's servers in file format.

ENDPOINTS
ENDPOINTS
POST /documents
GET /documents/:id
GET /documents

The document object

The document object represents a digitized document (generally a government ID or proof of address) in the shape of a file uploaded to Public Mint's servers.

A document is identified by a unique, random id and relates to a user's identityId.

DOCUMENT OBJECT
DOCUMENT OBJECT
{
"id": "6215e0aa-dde7-40ac-af3b-b6fa733529ff",
"identityId": "e65dde2c-4379-42c7-a665-3f476cebb691",
"status": "active",
"label": "identity card",
"description": "identity card of jonh smith",
"extension": ".jpg",
"fileUrl": "https://pmint-custodial-api-tst-identity-docs.s3.amazonaws.com/e6/5d/de/2c/tLHGdo6z3PgOp4lR.jpeg",
"documentType": "IdentityCard",
"documentSide": "FrontSide",
"createdAt": "2020-02-19T15:15:23.546Z",
"updatedAt": "2020-02-19T15:15:23.546Z",
"deletedAt": null
}

post
POST /documents

[ENVIRONMENT HOSTNAME]/documents
This endpoint allows you to submit a new document to the database. If all parameters are valid, a new record will be added to the database.
Request
Response
Request
Form Data Parameters
description
optional
string
Description associated to the document
documentSide
required
string
Side of the document Must be one of the following: - FrontSide - BackSide
documentType
required
string
Type of the document Must be one of the following: - IdentityCard; - DriverLicense; - Passport; - ResidencePermit; - UtilityBill; - Other.
identityId
required
string
Id of the identity associated to the document.
label
required
string
Label for the document.
file
required
object
Document file Requirements: - Needs to be a file; - Needs to be the last field in the form
Response
200: OK
Deposit successfully inserted in the database.
{
"created_at": "2019-08-26T13:48:49.620Z",
"description": "drivers licence of jonh smith",
"extension": "text/plain",
"file_url": "https://pmint-custodial-api-tst-identity-docs.s3.amazonaws.com/2019/08/26/14/6fLumDyWSkePtWsn.txt",
"id": "cf6fd88b-ed8f-42f0-b609-4abd3371c48c",
"identity_id": "12345678-1234-1234-1234-432112341234",
"owner_id": "12345678-1234-1234-1234-432112341234",
"label": "drivers license",
"mime_type": null,
"updated_at": "2019-08-26T13:48:49.620Z"
}

Example Call

Request
Curl
Response
Request
POST [ENVIRONMENT HOSTNAME]/documents
Curl
curl -X POST \
[ENVIRONMENT HOSTNAME]/documents \
-H 'Content-Type: multipart/form-data' \
-H "apikey: {INSERT YOUR API KEY HERE}" \
-F 'label=identity card' \
-F identityId=5f5e13fb-c5d7-488b-923b-278b96b138b9 \
-F documentType=IdentityCard \
-F documentSide=FrontSide \
-F 'file=@/Users/brunoramos/Downloads/public-mint-pk1562254784090_.txt'
Response
{
"id": "6215e0aa-dde7-40ac-af3b-b6fa733529ff",
"identityId": "5f5e13fb-c5d7-488b-923b-278b96b138b9",
"status": "active",
"label": "identity card",
"description": "identity card of jonh smith",
"extension": ".jpg",
"fileUrl": "https://pmint-custodial-api-tst-identity-docs.s3.amazonaws.com/e6/5d/de/2c/tLHGdo6z3PgOp4lR.jpeg",
"documentType": "IdentityCard",
"documentSide": "FrontSide",
"createdAt": "2020-02-19T15:15:23.546Z",
"updatedAt": "2020-02-19T15:15:23.546Z",
"deletedAt": null
}

get
GET /documents/:id

[ENVIRONMENT HOSTNAME]/documents/:id
This endpoint retrieves a single document that you own by its specific id attribute.
Request
Response
Request
Path Parameters
id
required
string
Id of the document to be retrieved
Response
200: OK
{
"id": "6215e0aa-dde7-40ac-af3b-b6fa733529ff",
"identityId": "e65dde2c-4379-42c7-a665-3f476cebb691",
"status": "active",
"label": "identity card",
"description": "identity card of jonh smith",
"extension": ".jpg",
"fileUrl": "https://pmint-custodial-api-tst-identity-docs.s3.amazonaws.com/e6/5d/de/2c/tLHGdo6z3PgOp4lR.jpeg",
"documentType": "IdentityCard",
"documentSide": "FrontSide",
"createdAt": "2020-02-19T15:15:23.546Z",
"updatedAt": "2020-02-19T15:15:24.864Z",
"deletedAt": null
}

Example Call

Request
Curl
Response
Request
GET [ENVIRONMENT HOSTNAME]/documents/6215e0aa-dde7-40ac-af3b-b6fa733529ff
Curl
curl -X GET \
[ENVIRONMENT HOSTNAME]/documents/6215e0aa-dde7-40ac-af3b-b6fa733529ff \
-H "apikey: {INSERT YOUR API KEY HERE}" \
Response
{
"id": "6215e0aa-dde7-40ac-af3b-b6fa733529ff",
"identityId": "e65dde2c-4379-42c7-a665-3f476cebb691",
"status": "active",
"label": "identity card",
"description": "identity card of jonh smith",
"extension": ".jpg",
"fileUrl": "https://pmint-custodial-api-tst-identity-docs.s3.amazonaws.com/e6/5d/de/2c/tLHGdo6z3PgOp4lR.jpeg",
"documentType": "IdentityCard",
"documentSide": "FrontSide",
"createdAt": "2020-02-19T15:15:23.546Z",
"updatedAt": "2020-02-19T15:15:24.864Z",
"deletedAt": null
}

get
GET /documents

[ENVIRONMENT HOSTNAME]/documents
This endpoint returns a list of all documents submitted by you.
Request
Response
Request
Response
200: OK
{
"total": 1,
"data": [
{
"id": "d7fae059-f8e1-4e00-b0ac-e244b3ca7362",
"identity_id": "32634b13-c370-4e77-afbc-2841d9d4b760",
"status": "active",
"label": "identity card",
"description": "identity card of jonh smith",
"extension": ".png",
"file_url": "https://pmint-custodial-api-sandbox-identity-docs.s3.amazonaws.com/32/63/4b/13/MQ830IZ0PMHNGnXW.png",
"document_type": "IdentityCard",
"document_side": "FrontSide",
"external_id": "7dae5b63-f264-4c2e-a1a7-e62a8f464349",
"external_system": "PrimeTrust",
"integ_status": "success",
"integ_messages": [],
"created_at": "2019-11-08T11:55:47.540Z",
"updated_at": "2019-11-08T11:55:48.655Z",
"deleted_at": null
}
]
}

Example Call

Request
Curl
Response
Request
GET [ENVIRONMENT HOSTNAME]/documents
// PAGINATED
GET [ENVIRONMENT HOSTNAME]/documents?page[number]=1&page[size]=1
Curl
curl -X GET \
"[ENVIRONMENT HOSTNAME]/documents" \
-H "apikey: {INSERT YOUR API KEY HERE}" \
Response
{
"total": 1,
"data": [
{
"id": "0acb6a86-e21e-45d6-a4e5-70bd4f85ecae",
"identityId": "e0564926-96e0-42e2-a544-68bc18598e40",
"status": "active",
"label": "identity card",
"description": "identity card of jonh smith",
"extension": ".jpeg",
"fileUrl": "https://pmint-custodial-api-tst-identity-docs.s3.amazonaws.com/e0/56/49/26/N5MXjSIhK0bGAOt2.jpeg",
"documentType": "IdentityCard",
"documentSide": "FrontSide",
"createdAt": "2020-01-10T17:24:23.561Z",
"updatedAt": "2020-01-10T17:24:24.455Z",
"deletedAt": null
}
]
}