Skip to Content
HelvetlyDocs
API referenceDocuments

Link a document to a record

Needs a token with the write:documents scope. Authentication

Try in Playground sends a real request to app.helvetly.com with a token you paste. It stays in this browser tab only (session storage) and goes to no one else.

POST
/api/v1/documents/{id}/links

Links a live document to a client, invoice or expense of the workspace (type, id). Linking to an issued invoice or a booked or void expense makes the document a business record kept for 10 years (it can no longer be trashed or deleted). Linking twice is a harmless no-op. 422 validation_failed when the record does not exist, 409 trashed for a trashed document. Answers 201 with the document.

Authorization

bearerAuth
headerAuthorizationBearer <token>

A personal API token, hvt_…, with scopes such as read:* or write:invoices

Path Parameters

id*string

The document's id.

Request Body

application/json
  1. body
type*string
Value in"client""invoice""expense"
id*string

Id of the client, invoice or expense in this workspace.

Response Body

Created

application/json
  1. response
data*

A document's metadata. The bytes come from download_document and get_document_content.

Example Request
curl -X POST 'https://app.helvetly.com/api/v1/documents/string/links' \  -H 'Content-Type: application/json' \  -d '{  "type": "client",  "id": "cli_01JABCDEF"}'
Example Response
{  "data": {    "id": "string",    "name": "string",    "folder_id": "string",    "folder": {      "id": "string",      "name": "string"    },    "size": 0,    "content_type": "string",    "kind": "pdf",    "previewable": true,    "sha256": "string",    "links": [      {        "type": "string",        "id": "string",        "label": "string",        "retains": true      }    ],    "retained_until": "2019-08-24",    "uploaded_by": {      "id": "string",      "name": "string"    },    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "deleted_at": "2019-08-24T14:15:22Z",    "deleted_by": {      "id": "string",      "name": "string"    },    "purge_at": "2019-08-24T14:15:22Z"  }}