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 |
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 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 |
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
POST /api/v1/users/:user_id/documents
URL Parameters
Parameter | Description |
---|---|
user_id | The ID of the user for whom to create a document for |
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
PUT /api/v1/users/:user_id/documents/:document_id
URL Parameters
Parameter | Description |
---|---|
user_id | The ID of the user of the document |
document_id | The ID of the document to update |
List
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
GET /api/v1/users/:user_id/documents
URL Parameters
Parameter | Description |
---|---|
user_id | The ID of the user for whom to list the documents for |
Show
Example response:
{ "data": { "id": "3aab0a84-8ed3-4ddf-8572-f1799bb60e0a", "type": "document", "attributes": { ... } }}
This endpoint returns a document.
HTTP Request
GET /api/v1/users/:user_id/documents/:document_id
URL Parameters
Parameter | Description |
---|---|
user_id | The ID of the user |
document_id | The ID of the document to return |
Delete
Example response:
{ "data": { "id": "bfcde02e-7e9e-4706-9504-ae0cecd5019c", "type": "document", "attributes": { ... } }}
This endpoint deletes a document with the given ID.
HTTP Request
DELETE /api/v1/users/:user_id/documents/:document_id
URL Parameters
Parameter | Description |
---|---|
user_id | The ID of the user of the document |
document_id | The ID of the document to delete |