Skip to content

Get file metadata

Endpoint

GET /organizations/{org_id}/assets/{asset_id}

This endpoint retrieves metadata (like filename, upload date, related object) for a specific uploaded file (referred to as an “Asset” in the API).

Request

Replace {org_id} with your Organization ID and {asset_id} with the Asset ID of the file whose metadata you want.

Headers

  • Authorization: Bearer {your_access_token}
  • Accept: application/json
  • X-Tallyfy-Client: APIClient

Query Parameters

No common query parameters are typically needed for this endpoint.

Code Samples

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const assetId = 'ASSET_ID_TO_GET_METADATA';
const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/assets/${assetId}`;
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
fetch(apiUrl, {
method: 'GET',
headers: headers
})
.then(response => {
if (!response.ok) {
// Error handling...
return response.json().then(errData => { throw new Error(/*...*/); }).catch(() => { throw new Error(/*...*/); });
}
return response.json();
})
.then(data => {
console.log(`Successfully retrieved metadata for asset ${assetId}:`);
console.log(JSON.stringify(data, null, 2));
})
.catch(error => {
console.error(`Error getting asset metadata ${assetId}:`, error);
});

Response

A successful request returns a 200 OK status code and a JSON object containing a data array (usually with one element) holding the asset metadata.

{
"data": [
{
"id": "ASSET_ID_TO_GET_METADATA",
"filename": "report_q1.pdf",
"version": 1,
"step_id": "step_id_xyz789", // If related to a task step
"uploaded_from": "capture_id_abc123", // Form field ID or 'ko_field'
"uploaded_to_s3": true,
"subject": {
"id": "run_id_or_checklist_id",
"type": "Run" // Or "Checklist"
},
"uploaded_at": "2024-04-15T11:00:00Z"
// Other potential metadata fields like size, uploader ID, etc.
}
]
}

If the asset ID is not found or you lack permission, a 404 or 403 error will be returned.