Zum Hauptinhalt springen

Upload assets with metadata

Put files into the media library with a folder, tags and values in your workspace's own fields, such as a product number or a usage right. Designs can then use them, and people find them by those values.

You need the values from Before you start.

1. Look up your fields and tags​

Custom fields are defined once per workspace, under Settings → Custom Fields. Read their IDs and types:

GET /api/organizations/{organizationId}/asset-fields
curl "https://app.heycreo.io/api/organizations/$ORGANIZATION_ID/asset-fields" \
-H "Authorization: Bearer $HEYCREO_API_KEY" \
| jq '.[] | {id, label, type, options: [.options[]? | {id, label}]}'

Tags are referenced by ID as well:

GET /api/organizations/{organizationId}/tags
curl "https://app.heycreo.io/api/organizations/$ORGANIZATION_ID/tags" \
-H "Authorization: Bearer $HEYCREO_API_KEY" | jq '.[] | {id, name}'

2. Upload a file with its metadata​

POST /api/organizations/{organizationId}/assets/upload
curl "https://app.heycreo.io/api/organizations/$ORGANIZATION_ID/assets/upload" \
-H "Authorization: Bearer $HEYCREO_API_KEY" \
-F "file=@sneaker-red.jpg" \
-F "ensureCollection=Product photos" \
-F 'tagIds=["TAG_ID"]' \
-F 'customFields={
"SKU_FIELD_ID": { "type": "text", "value": "SN-4711-RED" },
"RIGHTS_FIELD_ID": { "type": "date", "value": "2027-12-31" },
"CHANNEL_FIELD_ID": { "type": "multiselect", "optionIds": ["WEB_OPTION_ID", "PRINT_OPTION_ID"] }
}' | jq '{id, name, collectionId}'
Form field
fileRequired. Images (JPEG, PNG, GIF, WebP, SVG), audio (MP3, WAV, OGG, M4A, AAC) or video (MP4, MOV, AVI, WebM, MKV), up to 1 GB.
collectionIdThe folder to put the file in.
ensureCollectionA folder name instead: heycreo uses the folder of that name and creates it if it does not exist.
tagIdsA JSON array of tag IDs.
customFieldsA JSON object: field ID → value.
declareAiContenttrue marks the file as AI-generated.

Each value names its field's type:

Field typeValue
Text{ "type": "text", "value": "…" }
Number{ "type": "number", "value": 42 }
Yes/no{ "type": "boolean", "value": true }
Date{ "type": "date", "value": "2027-12-31" }
Select{ "type": "select", "optionId": "…" }
Multiselect{ "type": "multiselect", "optionIds": ["…", "…"] }
Check the values

Tags and field values are applied after the file is stored. A wrong ID or a value of the wrong type does not fail the upload: the file is there, without that value. Read the asset back to check, or set the values in a second request (step 3), which reports such errors.

GET /api/organizations/{organizationId}/assets/{assetId}
curl "https://app.heycreo.io/api/organizations/$ORGANIZATION_ID/assets/$ASSET_ID" \
-H "Authorization: Bearer $HEYCREO_API_KEY" | jq '{tags, customFields}'

Up to 120 uploads per minute are accepted. For larger imports, pause when you receive 429.

3. Change the metadata later​

One asset:

PATCH /api/organizations/{organizationId}/assets/{assetId}
curl -X PATCH "https://app.heycreo.io/api/organizations/$ORGANIZATION_ID/assets/$ASSET_ID" \
-H "Authorization: Bearer $HEYCREO_API_KEY" \
--json '{ "customFields": { "SKU_FIELD_ID": { "type": "text", "value": "SN-4711-RED-2" } } }'

Fields you leave out keep their value; null clears one. tagIds here replaces all of the asset's tags.

Many assets at once:

batch.json
{
"assetIds": ["ASSET_ID_1", "ASSET_ID_2"],
"mode": "add",
"tagIds": ["TAG_ID"],
"customFields": { "CHANNEL_FIELD_ID": { "type": "multiselect", "optionIds": ["SOCIAL_OPTION_ID"] } }
}
PATCH /api/organizations/{organizationId}/assets
curl -X PATCH "https://app.heycreo.io/api/organizations/$ORGANIZATION_ID/assets" \
-H "Authorization: Bearer $HEYCREO_API_KEY" \
--json @batch.json

mode decides what happens to existing values: overwrite (the default) replaces the tags and sets the fields, add adds tags and multiselect options, remove takes them away and clears other fields.

See also​

  • Assets
  • Webhooks: asset.created tells your system when a file someone else uploaded is ready, so it can fill in the fields.