Attach a file to an asset
/partners/fixed-assets/{uuid}/attachmentsAttaches an invoice, photo or warranty, uploaded as multipart `file` or downloaded from a public URL.
Send a `multipart/form-data` body with one `file`, or a JSON body with `url` (http or https) and an optional `fileName`; COUNT downloads the URL, virus-scans the file and stores a copy. Accepts PDF, Office documents, CSV, text and images, up to 20 MB each and 50 files per asset. A file served by a download endpoint keeps the name you give it, or gets an extension its type allows.
Headers
Idempotency-KeystringoptionalClient-generated key that makes the call safely retryable. Repeating a key replays the original response; reusing one with a different body is refused.
Path parameters
uuiduuidrequiredThe fixed asset UUID (`id` from List fixed assets).
Request body
filestringMultipart only: the file.
urlstringJSON only: public http(s) URL COUNT downloads.
fileNamestringJSON only: name to store the file under, 1–255 characters. Defaults to the name in the URL.
Responses
201The stored attachment.400Neither a file nor a URL, a URL that is not http(s) or cannot be downloaded, a file type that is not allowed, a file over 20 MB, a file that fails the virus scan, or an asset already holding 50 files.404No asset with that UUID in this workspace.401Missing or invalid HMAC signature, expired timestamp, or invalid Bearer token. Troubleshoot403The credential does not have access to this workspace or resource. Troubleshoot429Rate limit exceeded (100 requests per minute per user of each app, or 10,000 per minute per app). Retry after the Retry-After header. Troubleshoothttps://api.getcount.com/partners/fixed-assets/{uuid}/attachmentsimport crypto from 'node:crypto';
const BASE_URL = 'https://api.getcount.com';
const CLIENT_ID = process.env.COUNT_CLIENT_ID;
const CLIENT_SECRET = process.env.COUNT_CLIENT_SECRET;
const ACCESS_TOKEN = process.env.COUNT_ACCESS_TOKEN;
const method = 'POST';
const signingPath = '/fixed-assets/3fa85f64-5717-4562-b3fc-2c963f66afa6/attachments';
const timestamp = Math.floor(Date.now() / 1000).toString();
const body = {
"url": "https://example.com/invoices/macbook-invoice.pdf",
"fileName": "macbook-invoice.pdf"
};
const bodyString = JSON.stringify(body);
const bodyHash = crypto.createHash('sha256').update(bodyString).digest('hex');
const baseString = `${method}:${signingPath}:${timestamp}:${bodyHash}`;
const signature = crypto.createHmac('sha256', CLIENT_SECRET).update(baseString).digest('hex');
const response = await fetch(`${BASE_URL}/partners/fixed-assets/3fa85f64-5717-4562-b3fc-2c963f66afa6/attachments`, {
method,
headers: {
'x-client-id': CLIENT_ID,
'x-timestamp': timestamp,
'x-signature': signature,
'Content-Type': 'application/json',
Authorization: `Bearer ${ACCESS_TOKEN}`,
'Idempotency-Key': '3fa85f64-5717-4562-b3fc-2c963f66afa6',
},
body: bodyString,
});
console.log(await response.json());{
"status": "success",
"message": "Success on adding fixed asset attachment",
"data": {
"attachment": {
"id": "0194c1d2-3e4f-7a5b-8c6d-7e8f9a0b3a01",
"fileName": "macbook-invoice.pdf",
"fileType": "application/pdf",
"fileSize": 184320,
"fileUrl": "https://countstorage.blob.core.windows.net/fixed-assets/macbook-invoice.pdf?sv=2024-11-04&se=2026-11-19T11%3A00%3A00Z&sig=...",
"uploadedBy": {
"firstName": "Ana",
"lastName": "Reyes"
},
"createdAt": "2026-01-15T10:30:00.000Z"
}
}
}