Salesly API
API Reference

Upload a document to a contact

Uploads a file and links it to the contact. Maximum size 20 MB. Note that `Idempotency-Key` cannot fingerprint a multipart body, so re-using a key with a *different* file replays the first response rather than returning 422.

POST
/contacts/{identifier}/documents

Authorization

x-api-key<token>

Your tenant API key

In: header

Request Body

multipart/form-dataRequired
file
Required
file

Max 20 MB. Allowed types: pdf, doc, docx, xls, xlsx, csv, txt, png, jpg, jpeg, gif, webp. The extension must match the file's actual content.

Format: "binary"
namestring

Defaults to the uploaded file's base name.

Maximum length: 255
document_category_idinteger

Defaults to the workspace's general category.

Path Parameters

identifier
Required
string

Accepts any of the following (matched in order): numeric ID, name, email, or CIF/tax identifier. The first matching contact is returned. Use the numeric ID for unambiguous lookups.

curl -X POST "https://rest.salesly.app/api/v1/developers/contacts/string/documents" \
  -H "x-api-key: <token>" \
  -F file="string" \
  -F name="string" \
  -F document_category_id="0"

Document created and linked

{
  "data": {
    "id": 12,
    "name": "Signed contract",
    "filename": "6f1c8e2a-6b1e-4c8a-9f2d-0b7a1c3d5e9f_contract.pdf",
    "extension": "PDF",
    "mime_type": "application/pdf",
    "size_bytes": 184320,
    "contact_id": 42,
    "category_id": 1,
    "opportunity_ids": [
      0
    ],
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
}