Asset API
The Asset API stores and manages files in two ways:
- Assets are files for creatives, such as images, PDF files, and HTML5 creative assets (ZIP files), served from a CDN URL. The Asset API handles media uploads and temporary storage, and works with other services, such as the Creative API, for final storage and metadata management.
- Secure files are kept in private storage and shared through presigned URLs that expire. They have no CDN URL. Each secure file belongs to the Organization Workspace that uploaded it, and only users in that Workspace can access it.
To upload a secure file:
- Initiate secure file upload to get a fileId and a presigned uploadUrl.
- Send the file to uploadUrl in a
PUTrequest before the URL expires. Set theContent-Typeheader to the file type's content type and send exactly the number of bytes given in size. Don't send IQM authentication headers to this URL. - Complete secure file upload to confirm the file is uploaded.
After that, you can get a download URL for the file.
This page covers the common endpoints and methods associated with the Asset API.
More resources
- Creative ad specs and requirements Help Center article
Authentication
Use the following header parameters for all requests:
| Headers | |
|---|---|
Authorization string required | Bearer followed by the access_token from the login response. See Sign up and authenticate. |
X-IAA-OW-ID integer required | Organization Workspace ID header. |
Assets details
Get a list of all assets
GETGet a list of all assets in the system. Includes both regular assets and HTML5 creative assets.
An asset id can be used to Get asset details or to perform various actions in Assets management endpoints.
Response properties
id integer | Asset ID. |
storagePath string | File path of asset. |
cdnUrl string | URL of asset. |
created integer | Unix epoch timestamp of asset creation, in milliseconds. |
modifiedDate string | Date asset modified. |
isDisposable boolean | Indicates whether asset is temporary and can be purged. |
isZipFile boolean | Indicates whether the asset is a ZIP file. |
isHtml5Creative boolean | Indicates whether the asset is an HTML5 creative. |
assetDimensions object | Dimensions of the creative (HTML5 assets only). Contains width and height. |
iframeHtml string | Ready-to-use iframe HTML code (HTML5 assets only). |
- JSON
{
"success": true,
"data": [
{
"id": 1,
"storagePath": "assets/201427/tfteBYO_1704204958735.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/tfteBYO_1704204958735.jpg",
"created": 1704204961147,
"modifiedDate": "2024-01-02T14:16:08.726+0000",
"isDisposable": false,
"isZipFile": false,
"isHtml5Creative": false,
"assetDimensions": null,
"iframeHtml": null
},
{
"id": 2,
"storagePath": "assets/201427/randomPath/index.html",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/randomPath/index.html",
"created": 1704204971010,
"modifiedDate": "2024-01-02T14:16:11.375+0000",
"isDisposable": true,
"isZipFile": true,
"isHtml5Creative": true,
"assetDimensions": {
"width": 300,
"height": 250
},
"iframeHtml": "<iframe src=\"https://d3jme5si7t6llb.cloudfront.net/assets/201427/randomPath/index.html\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>"
},
{
"id": 3,
"storagePath": "assets/201427/2mBGamD_1704205759807.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/2mBGamD_1704205759807.jpg",
"created": 1704205761106,
"modifiedDate": "2024-01-02T08:59:21.508+0000",
"isDisposable": false,
"isZipFile": false,
"isHtml5Creative": false,
"assetDimensions": null,
"iframeHtml": null
}
]
}
Get asset details
GETGet properties of a single asset by ID. For HTML5 creative assets, the response includes additional fields for dimensions and iframe HTML code.
| Path parameters | |
|---|---|
assetId integer | Asset ID. |
Response properties
id integer | Asset ID. |
storagePath string | File path of asset. |
cdnUrl string | URL of asset. |
created integer | Unix epoch timestamp of asset creation, in milliseconds. |
modifiedDate string | Date asset modified. |
isDisposable boolean | Indicates whether asset is temporary and can be purged. |
isZipFile boolean | Indicates whether the asset is a ZIP file. |
isHtml5Creative boolean | Indicates whether the asset is an HTML5 creative. |
assetDimensions object | Dimensions of the creative (HTML5 assets only). Contains width and height. |
iframeHtml string | Ready-to-use iframe HTML code (HTML5 assets only). |
- JSON
{
"success": true,
"data": {
"id": 1,
"storagePath": "assets/201427/tfteBYO_1704204958735.jpg",
"cdnUrl": "https://cdn.example.com/assets/201427/tfteBYO_1704204958735.jpg",
"created": 1704204961147,
"modifiedDate": "2024-01-18T06:03:23.823+0000",
"isDisposable": true,
"isZipFile": false,
"isHtml5Creative": false,
"assetDimensions": null,
"iframeHtml": null
}
}
{
"success": false,
"errorObjects": [
{
"error": "No Asset found with the Asset ID provided. Please provide a valid ID."
}
]
}
Assets management
Add multiple assets
POSTAdd multiple assets to the system. Request accepts an array of multipart file objects and their corresponding metadata. Supports both regular assets (images, PDFs) and HTML5 creative assets (ZIP files).
| Parameters | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
filesMetadata form data required | Object array in JSON string. | |||||||||||
| ||||||||||||
attachedFileName string | Name of asset. |
originalFileName string | Name of uploaded multipart file. |
disposable boolean | Indicates whether asset is temporary and can be purged, default: false. |
zipFile boolean | Set to true when uploading a ZIP file for HTML5 creatives, default: false. |
html5Creative boolean | Set to true when uploading an HTML5 creative asset, default: false. |
files multipart/form-data required
Response properties
assetID integer | Unique identifier of the uploaded asset. |
assetCDNURL string | CDN URL of the uploaded asset. |
dimensions object | Dimensions of the creative (HTML5 assets only). Contains width and height. |
iframeHtml string | Ready-to-use iframe HTML code (HTML5 assets only). |
- JSON
------WebKitFormBoundaryAofpaWXja6BTaYQ9
Content-Disposition: form-data; name="files"; filename="example.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryAofpaWXja6BTaYQ9
Content-Disposition: form-data; name="filesMetadata"
[{"attachedFileName":"example.jpg","originalFileName":"example.jpg","disposable":false}]
------WebKitFormBoundaryAofpaWXja6BTaYQ9--
{
"success": true,
"data": {
"example.jpg": {
"assetID": 697,
"assetCDNURL": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/IHp2jMI_1704987233847.jpg"
}
}
}
{
"success": false,
"errorObjects": [
{
"error": "Please pass File(s) metaData"
}
]
}
Update asset details
PATCHUpdate the details of an existing asset by ID.
| Path parameters | |
|---|---|
assetId integer | Asset ID. |
| Request schema | |
|---|---|
storagePath string | File path of asset. |
cdnUrl string | Asset CDN URL. |
disposable boolean | Indicates whether asset is temporary and can be purged (true), default: true. |
- JSON
{
"storagePath": "string",
"cdnUrl": "string",
"disposable": true
}
{
"success": true,
"data": {
"statusCode": 200,
"responseObject": {
"message": "Asset updated successfully"
}
}
}
Delete asset
DELETEDelete a single asset by ID.
| Path parameters | |
|---|---|
assetId integer | Asset ID. |
- JSON
{
"success": true,
"data": "Asset deleted successfully."
}
Secure files
Initiate secure file upload
POSTStart a secure file upload. Returns a file ID and a presigned URL to upload the file to, which expires after expiresInSeconds (currently 600 seconds).
| Request schema | |
|---|---|
fileName string required | File name, including the extension. The extension must match fileType. Spaces are replaced with underscores, and characters other than letters, numbers, ., _, and - are removed. |
fileType string required | File type. See the table below for allowed values. |
size integer required | File size in bytes, up to 524288000 (500 MB). The uploaded file must be exactly this size. |
folderName string | Folder to group the file under in storage. Letters, numbers, _, and - only, up to 100 characters. |
fileType | Extensions | Content-Type for the upload |
|---|---|---|
| CSV | .csv | text/csv |
| EXCEL | .xlsx, .xls | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (.xlsx) or application/vnd.ms-excel (.xls) |
| ZIP | .zip | application/zip |
| KMZ | .kmz | application/vnd.google-earth.kmz |
| KML | .kml | application/vnd.google-earth.kml+xml |
.pdf | application/pdf | |
| DOC | .doc | application/msword |
| DOCX | .docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| TXT | .txt | text/plain |
| MD | .md | text/markdown |
| PNG | .png | image/png |
| JPG | .jpg | image/jpg |
| JPEG | .jpeg | image/jpeg |
| GIF | .gif | image/gif |
| MOV | .mov | video/quicktime |
| MP4 | .mp4 | video/mp4 |
| MP3 | .mp3 | audio/mpeg |
| WAV | .wav | audio/wav |
| OGG | .ogg | audio/ogg |
Response properties
fileId string | File ID (UUID). Use it in the other secure file endpoints. |
uploadUrl string | Presigned URL to PUT the file to. |
expiresInSeconds integer | Seconds until uploadUrl expires. |
- JSON
{
"fileName": "campaign_assets.zip",
"fileType": "ZIP",
"size": 204800,
"folderName": "customer-imports"
}
{
"success": true,
"data": {
"fileId": "a3f1c2d4-8b7e-4f5a-9c6d-1e2b3a4c5d6e",
"uploadUrl": "https://s3.amazonaws.com/secure-bucket/123/a3f1c2d4.../campaign_assets.zip?X-Amz-Signature=...",
"expiresInSeconds": 600
}
}
curl -X PUT "<uploadUrl>" \
-H "Content-Type: application/zip" \
--data-binary @campaign_assets.zip
More responses
{
"success": false,
"errorObjects": [
{
"error": "fileType ZIP requires a .zip file extension"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "Unable to generate unique file id. Please retry."
}
]
}
Complete secure file upload
POSTConfirm that a file was uploaded to its presigned URL. IQM checks that the file is in storage and matches the size given when the upload was initiated, then sets its status to UPLOADED. Call this once per file.
| Path parameters | |
|---|---|
fileId string required | File ID. |
Response properties
status string | File status: UPLOADED. |
- JSON
{
"success": true,
"data": {
"status": "UPLOADED"
}
}
More responses
{
"success": false,
"errorObjects": [
{
"error": "Uploaded object not found"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "Uploaded file size mismatch"
}
]
}
Get secure file details
GETGet the details of a secure file by ID. Deleted files return a 404 response.
| Path parameters | |
|---|---|
fileId string required | File ID. |
Response properties
fileId string | File ID. |
fileName string | Stored file name, after spaces and unsupported characters are replaced or removed. |
originalFileName string | File name as given when the upload was initiated. Downloads use this name. |
fileType string | File type. |
size integer | File size in bytes. |
status string | File status: INITIATED (waiting for the upload to be completed) or UPLOADED. |
- JSON
{
"success": true,
"data": {
"fileId": "a3f1c2d4-8b7e-4f5a-9c6d-1e2b3a4c5d6e",
"fileName": "campaign_assets.zip",
"originalFileName": "campaign_assets.zip",
"fileType": "ZIP",
"size": 204800,
"status": "UPLOADED"
}
}
More responses
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
Get secure file download URL
GETGet a presigned URL to download a secure file. The file must have the UPLOADED status. The URL needs no authentication headers, downloads the file under its originalFileName, and expires after expiresInSeconds (currently 120 seconds).
| Path parameters | |
|---|---|
fileId string required | File ID. |
Response properties
downloadUrl string | Presigned URL to download the file. |
expiresInSeconds integer | Seconds until downloadUrl expires. |
- JSON
{
"success": true,
"data": {
"downloadUrl": "https://s3.amazonaws.com/secure-bucket/123/a3f1c2d4.../campaign_assets.zip?X-Amz-Signature=...",
"expiresInSeconds": 120
}
}
More responses
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "File is not ready for download"
}
]
}
Delete secure file
DELETEDelete a secure file by ID and remove it from storage. Works whether or not the upload was completed. Deleting a file that's already deleted also returns a 200 response.
| Path parameters | |
|---|---|
fileId string required | File ID. |
- JSON
{
"success": true,
"data": null
}
More responses
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
{
"success": false,
"errorObjects": [
{
"error": "File status changed during deletion"
}
]
}