Create an upload target for a creative file
curl --request POST \
--url https://myunite.ai/api/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sizeBytes": 123,
"filename": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({sizeBytes: 123, filename: '<string>'})
};
fetch('https://myunite.ai/api/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://myunite.ai/api/v1/uploads"
payload = {
"sizeBytes": 123,
"filename": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"uploadId": "<string>",
"uploadUrl": "<string>",
"method": "PUT",
"headers": {
"Content-Type": "<string>",
"Cache-Control": "<string>"
},
"expiresAt": "<string>"
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}Uploads
Create an upload target for a creative file
Creates a pre-signed URL to upload a creative file. Send the file with a PUT to uploadUrl, using the method and every header returned in headers, with exactly those values (Cache-Control is part of them). The URL is valid for 15 minutes. Then pass uploadId when you create the pre-test. Accepted types: PNG, JPEG, WebP and GIF images, MP4 and QuickTime videos (images up to 25 MB, videos up to 200 MB). The file content is checked when you create the pre-test, not at upload time. A body that is not valid JSON is 400; a field that is missing, wrongly typed or unknown is 422 invalid_request; an unsupported contentType is 422 upload_invalid.
Requires the pretests:write scope.
POST
/
uploads
Create an upload target for a creative file
curl --request POST \
--url https://myunite.ai/api/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sizeBytes": 123,
"filename": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({sizeBytes: 123, filename: '<string>'})
};
fetch('https://myunite.ai/api/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://myunite.ai/api/v1/uploads"
payload = {
"sizeBytes": 123,
"filename": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"uploadId": "<string>",
"uploadUrl": "<string>",
"method": "PUT",
"headers": {
"Content-Type": "<string>",
"Cache-Control": "<string>"
},
"expiresAt": "<string>"
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}Autorizações
Corpo
application/json
Resposta
Upload target.