User Documents
List of valid attributes:
| Attribute | Description | Specifics |
|---|---|---|
| created_at | Timestamp of document creation | Cannot be set |
| extension | File extension, e.g. pdf | Required field, Must be either pdf or doc, Cannot be updated |
| name | Name for a document | Required field. Maximum length is 250 code points |
| sensitive | Whether document is sensitive or not | Required, can be true or false |
| upload_status | File upload status | Cannot be set, either uploading, success or error |
| visible_to_user | Whether user has access to this document | Required, can be true or false |
Meta data: Upload/Download URL
| Parameter | Allowed values | Description |
|---|---|---|
| download_url | true/false | When passing true on GET endpoints, it generates a temporary URL to use for downloading the document |
| upload_url | true/false | When passing true on CREATE endpoint, it generates a temporary URL to use for uploading the document |
Note: upload_url returns a presigned POST S3 object, which contains url
and fields keys, which can be used for HTML form. Maximum file size for upload
is 100MB.
Create
Section titled “Create”Example request:
{ "data": { "type": "document", "data": { "attributes": { "extension": "pdf", "name": "Document Name", "sensitive": true, "visible_to_user": true } } }}Example response:
{ "data": { "id": "52370ab1-7d08-4a03-b0ac-4ba63c8f209d", "type": "document", "attributes": { ... } }}On success, this endpoint creates a new document with
upload_status = "uploading". Also generates a presigned URL for uploading the
document, if upload_url meta is passed.
HTTP Request
Section titled “HTTP Request”POST /api/v1/users/:user_id/documents
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user for whom to create a document for |
Update
Section titled “Update”Example request:
{ "data": { "type": "document", "data": { "attributes": { "name": "Document Name", "visible_to_user": true, "upload_status": "success" } } }}Example response:
{ "data": { "id": "52370ab1-7d08-4a03-b0ac-4ba63c8f209d", "type": "document", "attributes": { ... } }}On success, this endpoint updates the document with the given ID and returns it.
HTTP Request
Section titled “HTTP Request”PUT /api/v1/users/:user_id/documents/:document_id
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user of the document |
| document_id | The ID of the document to update |
Example response:
{ "data": [ { "id": "0a7cd22a-ceab-4b38-a6a2-1ea9e550ca53", "type": "document", "attributes": { ... } }, { ... } ]}This endpoint returns all of a user’s documents to which he has access.
HTTP Request
Section titled “HTTP Request”GET /api/v1/users/:user_id/documents
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user for whom to list the documents for |
Example response:
{ "data": { "id": "3aab0a84-8ed3-4ddf-8572-f1799bb60e0a", "type": "document", "attributes": { ... } }}This endpoint returns a document.
HTTP Request
Section titled “HTTP Request”GET /api/v1/users/:user_id/documents/:document_id
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user |
| document_id | The ID of the document to return |
Delete
Section titled “Delete”Example response:
{ "data": { "id": "bfcde02e-7e9e-4706-9504-ae0cecd5019c", "type": "document", "attributes": { ... } }}This endpoint deletes a document with the given ID.
HTTP Request
Section titled “HTTP Request”DELETE /api/v1/users/:user_id/documents/:document_id
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user of the document |
| document_id | The ID of the document to delete |