Skip to main content
POST
/
v1
/
files
Upload File
const form = new FormData();
form.append('file', '<string>');

const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};

options.body = form;

fetch('https://api.decart.ai/v1/files', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "<string>",
  "filename": "<string>",
  "mime_type": "<string>",
  "size_bytes": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z"
}

Authorizations

x-api-key
string
header
required

Headers

x-api-key
string
required

API key for authentication

User-Agent
string | null

Body

multipart/form-data
file
file
required

File to upload

ttl_seconds
string | null

TTL in seconds (60..2_592_000), or "persistent" for no expiry. Omit for the platform default (24h).

Response

Successful Response

id
string
required
filename
string | null
required
mime_type
string
required
size_bytes
integer
required
created_at
string<date-time>
required
expires_at
string<date-time> | null
required