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 Tallyfy’s 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 (optional)

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) {
// Attempt to parse error as JSON, fallback to text
return response.json()
.catch(() => response.text()) // If JSON parsing fails, get text
.then(errData => {
console.error(`Error response for asset ${assetId}:`, errData);
throw new Error(`HTTP error! status: ${response.status}`);
});
}
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.message);
});

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, Tallyfy will return a 404 or 403 error.


Files > Download file

The API provides two endpoints for retrieving file content with GET requests that return raw file data rather than JSON where one displays files inline and the other forces download as attachment with proper Content-Type and Content-Disposition headers for filename handling.

Files > Delete file

A DELETE endpoint that removes uploaded files from tasks or kick-off forms by making authorized requests to either /organizations/[org_id]/file/[asset_id] or /organizations/[org]/assets/[assetID] endpoints and returns a 200 OK status code upon successful deletion.

Code Samples > Managing files

The API enables file management functionalities including uploading downloading getting metadata and removing files associated with tasks or kick-off forms.

Tags > Get tag

The GET endpoint enables retrieval of specific tag details through unique IDs with optional related data inclusion and returns a JSON response containing tag information along with error handling for invalid requests or permissions.