Asset Metadata
Retrieve metadata for a specific asset, including permissions and assignments.
Endpoint
| Method | Endpoint | Description |
|---|---|---|
| GET | /assets/v1/asset/{assetId} | Get asset metadata |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| assetId | integer | Yes | Unique identifier of the asset |
Example Request
curl --request GET \
--url https://api.connecteam.com/assets/v1/asset/12345 \
--header 'X-API-KEY: YOUR_API_KEY'Response
{
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"data": {
"permissions": [
{
"userId": 9170357
},
{
"userId": 9170358
}
],
"assignments": {
"userIds": [9170359, 9170360, 9170361],
"smartGroups": ["sg-marketing", "sg-sales"]
}
}
}Response Fields
Root Object
| Field | Type | Description |
|---|---|---|
| permissions | array | Users with admin/edit access |
| assignments | object | Assignment details |
Permissions Object
| Field | Type | Description |
|---|---|---|
| userId | integer | User ID with permissions |
Assignments Object
| Field | Type | Description |
|---|---|---|
| userIds | array | List of assigned user IDs |
| smartGroups | array | List of assigned smart group IDs |
Use Cases
Audit Asset Access
Determine who has access to a specific asset for compliance or auditing purposes.
async function auditAssetAccess(assetId) {
const response = await fetch(
`https://api.connecteam.com/assets/v1/asset/${assetId}`,
{ headers: { 'X-API-KEY': 'YOUR_API_KEY' } }
);
const data = await response.json();
console.log('Admins:', data.data.permissions.map(p => p.userId));
console.log('Assigned Users:', data.data.assignments.userIds);
console.log('Assigned Groups:', data.data.assignments.smartGroups);
return data.data;
}Check User Assignment
async function isUserAssignedToAsset(assetId, userId) {
const response = await fetch(
`https://api.connecteam.com/assets/v1/asset/${assetId}`,
{ headers: { 'X-API-KEY': 'YOUR_API_KEY' } }
);
const data = await response.json();
return data.data.assignments.userIds.includes(userId);
}
// Check if user 9170359 is assigned to asset 12345
const isAssigned = await isUserAssignedToAsset(12345, 9170359);
console.log('User is assigned:', isAssigned);Sync External Systems
class AssetSyncService {
constructor(apiKey) {
this.apiKey = apiKey;
}
async getAssetMetadata(assetId) {
const response = await fetch(
`https://api.connecteam.com/assets/v1/asset/${assetId}`,
{ headers: { 'X-API-KEY': this.apiKey } }
);
return response.json();
}
async syncToExternalLMS(assetIds) {
const results = [];
for (const assetId of assetIds) {
const { data } = await this.getAssetMetadata(assetId);
// Sync to external system
results.push({
assetId,
assignedUserCount: data.assignments.userIds.length,
assignedGroupCount: data.assignments.smartGroups.length,
adminCount: data.permissions.length
});
}
return results;
}
}
// Usage
const syncService = new AssetSyncService('YOUR_API_KEY');
const syncResults = await syncService.syncToExternalLMS([12345, 12346, 12347]);
console.log(syncResults);Error Responses
404 Not Found
Asset not found:
{
"detail": "Asset not found"
}403 Forbidden
No access to asset:
{
"detail": "Access denied to this asset"
}Updated 11 days ago
