Use this endpoint to upload single asset.
For large files, such as videos of up to 1 GB, use Upload Large Assets (Presigned Upload). To save an already-uploaded asset to the Media Library, use Add an Asset to the Media Library.
Request
End Point https://business.newsbreak.com/business-api/v1/ad/uploadAssets
Method POST
Header
| Field | Required | Data Type | Description |
|---|---|---|---|
| Access-Token | Y | string | Authorized access token. |
| Content-Type | Y | string | Request message type Allowed format: multipart/form-data. |
Request Parameters
| Field | Required | Data Type | Description |
|---|---|---|---|
| asset | Y | binary | Assets to be uploaded. |
| adAccountId | Y | string | ID of the ad account of the ad. |
| saveToMediaLibrary | N | boolean | Save that media to the account's Media Library (reusable in the ad platform UI) |
| mediaName | N | string |
Media Name (3-256 chars) Required only if saveToMediaLibrary=true |
Example
curl -X 'POST' \
'https://business.newsbreak.com/business-api/v1/ad/uploadAssets' \
-F "asset=@/Users/tom/Documents/test1.png" \
-F "adAccountId=1234567" \
-F "saveToMediaLibrary=true" \
-F "mediaName=Holiday Campaign 1" \
-H 'accept: application/json' \
-H 'Access-Token: {{Access-Token}}'
Response
Response Parameters
| Field | Data Type | Description |
|---|---|---|
| code | int | Status code, see Return Codes. |
| errMsg | string | Error message when code!=0. |
| data | object | Response object. |
| └── assetUrl | string | Url of the image/video/gif. |
| └── mediaId | string | Media ID. |
Example
{
"code": 0,
"data": {
"assetUrl": "https://static.particlenews.com/nova/assets/1234567/example.png"
"mediaId": "987654321012345678"
}
}Upload Large Assets (Presigned Upload)
Use this endpoint to upload a large asset, such as a video of up to 1 GB, directly to NewsBreak's storage. Smaller files can still use the multipart upload above.
The upload takes three steps:
- Call this endpoint with the file's extension, content type, SHA-256 hash and size. It returns an upload URL, a set of form fields and the final
assetUrl. - Send the file to the upload URL as a
multipart/form-dataPOST that contains all of the returned fields, followed by the file itself in a field namedfile. - Use the
assetUrlin Create an Ad, or save it to the Media Library with Add an Asset to the Media Library.
This endpoint is available only to ad accounts that have large asset upload enabled. Contact your account manager to enable it.
Request
End Point https://business.newsbreak.com/business-api/v1/ad/uploadAssets/presign
Method POST
Header
| Field | Required | Data Type | Description |
|---|---|---|---|
| Access-Token | Y | string | Authorized access token. |
| Content-Type | Y | string | Request message type Allowed format: application/json. |
Query Parameters
| Field | Required | Data Type | Description |
|---|---|---|---|
| adAccountId | Y | string | ID of the ad account the asset belongs to. |
Request Parameters
| Field | Required | Data Type | Description |
|---|---|---|---|
| ext | Y | string | File extension without the dot, 1-8 letters or digits, for example mp4. Lowercase is recommended. |
| contentType | Y | string | MIME type of the file. Must start with image/ or video/, for example video/mp4. The upload must use exactly this value. |
| contentHash | Y | string | SHA-256 hash of the file, as 64 lowercase hexadecimal characters. |
| size | Y | long | File size in bytes. Maximum 1,073,741,824 (1 GB) when contentType starts with video/, otherwise 524,288,000 (500 MB). |
Example
shasum -a 256 holiday.mp4
# 7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8 holiday.mp4
curl -X 'POST' \
'https://business.newsbreak.com/business-api/v1/ad/uploadAssets/presign?adAccountId=1234567' \
-H 'Access-Token: {{Access-Token}}' \
-H 'Content-Type: application/json' \
-d '{
"ext": "mp4",
"contentType": "video/mp4",
"contentHash": "7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8",
"size": 599854778
}'Response
Response Parameters
| Field | Data Type | Description |
|---|---|---|
| code | int | Status code, see Return Codes. |
| errMsg | string | Error message when code!=0. |
| data | object | Response object. |
| └── assetUrl | string | URL the asset will be served from once the upload in step 2 succeeds. |
| └── upload | object | Where and how to upload the file. |
| └── url | string | Upload URL. Send the file here with a multipart/form-data POST. |
| └── fields | object | Form fields to include in the upload, as name/value pairs. Send every field unchanged and put the file last, in a field named file. |
Example
{
"code": 0,
"data": {
"assetUrl": "https://static.particlenews.com/nova/assets/1234567/7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8.mp4",
"upload": {
"url": "https://a1prod.s3.us-west-2.amazonaws.com",
"fields": {
"key": "nova/assets/1234567/7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8.mp4",
"Content-Type": "video/mp4",
"Cache-Control": "max-age=31536000",
"x-amz-checksum-algorithm": "SHA256",
"x-amz-checksum-sha256": "...",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "...",
"x-amz-date": "20261102T233708Z",
"x-amz-security-token": "...",
"policy": "...",
"x-amz-signature": "..."
}
}
}
}Upload the File
Send every entry of upload.fields as a form field, then the file as the last field, named file. A successful upload returns HTTP 204 No Content with an empty body.
- The upload URL is valid for 60 minutes. After that, call this endpoint again.
- The file must be the exact file you hashed: the storage service rejects the upload if its SHA-256 doesn't match
contentHash, if it is larger thansize, or if its Content-Type differs fromcontentType. - Upload errors come from the storage service as XML, not as the JSON format above.
- The
assetUrlis derived from the file's hash, so uploading the same file again returns the sameassetUrl.
Example
curl -X 'POST' 'https://a1prod.s3.us-west-2.amazonaws.com' \
-F 'key=nova/assets/1234567/7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8.mp4' \
-F 'Content-Type=video/mp4' \
-F 'Cache-Control=max-age=31536000' \
-F 'x-amz-checksum-algorithm=SHA256' \
-F 'x-amz-checksum-sha256=...' \
-F 'x-amz-algorithm=AWS4-HMAC-SHA256' \
-F 'x-amz-credential=...' \
-F 'x-amz-date=20261102T233708Z' \
-F 'x-amz-security-token=...' \
-F 'policy=...' \
-F 'x-amz-signature=...' \
-F 'file=@holiday.mp4'Errors
| Code | HTTP Status | Description |
|---|---|---|
| 4000 | HTTP 400 | A request parameter is missing or invalid, for example size above 1 GB or contentHash not 64 lowercase hex characters. |
| 40101 | HTTP 400 |
size is above the limit for the content type (1 GB for videos, 500 MB otherwise). |
| 42033 | HTTP 400 | Large asset upload is not enabled for this ad account. |
Add an Asset to the Media Library
Use this endpoint to save an asset that is already uploaded to an ad account to that account's Media Library, so it can be reused in the ad platform UI.
The asset can come from either upload method above. With the multipart upload you can also set saveToMediaLibrary=true to do both in one call.
Request
End Point https://business.newsbreak.com/business-api/v1/media/create
Method POST
Header
| Field | Required | Data Type | Description |
|---|---|---|---|
| Access-Token | Y | string | Authorized access token. |
| Content-Type | Y | string | Request message type Allowed format: application/json. |
Request Parameters
| Field | Required | Data Type | Description |
|---|---|---|---|
| adAccountId | Y | string | ID of the ad account that owns the asset. |
| assetUrl | Y | string |
assetUrl returned by an upload endpoint for this ad account. The upload must have completed, and the asset must belong to the same ad account. |
| mediaName | Y | string | Media name (3-256 chars). |
Example
curl -X 'POST' \
'https://business.newsbreak.com/business-api/v1/media/create' \
-H 'Access-Token: {{Access-Token}}' \
-H 'Content-Type: application/json' \
-d '{
"adAccountId": "1234567",
"assetUrl": "https://static.particlenews.com/nova/assets/1234567/7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8.mp4",
"mediaName": "Holiday Campaign 1"
}'Response
Response Parameters
| Field | Data Type | Description |
|---|---|---|
| code | int | Status code, see Return Codes. |
| errMsg | string | Error message when code!=0. |
| data | object | Response object. |
| └── assetUrl | string | Url of the image/video. |
| └── mediaId | string | Media ID. |
Example
{
"code": 0,
"data": {
"assetUrl": "https://static.particlenews.com/nova/assets/1234567/7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8.mp4",
"mediaId": "987654321012345678"
}
}If the asset is already in the Media Library, the endpoint returns HTTP 409 and the existing media in data, so you can use that mediaId directly:
{
"code": -1,
"errMsg": "Fail to create media: media with the same content already exists.",
"data": {
"assetUrl": "https://static.particlenews.com/nova/assets/1234567/7144be57fc7b42d6e93509a0d3131c4dba970f93802be5c5599281f5016bc9e8.mp4",
"mediaId": "987654321012345678"
}
}Errors
| Code | HTTP Status | Description |
|---|---|---|
| -1 | HTTP 409 | The asset is already in the Media Library. data holds the existing mediaId. |
| 4000 | HTTP 400 | A request parameter is missing or invalid, for example mediaName shorter than 3 characters. |
| 40106 | HTTP 400 | The asset is not an image or a video. |
| 40125 | HTTP 400 | The asset doesn't exist: the upload hasn't completed, or assetUrl doesn't belong to this ad account. |