comecerodocs

Upload a file

POST
/files

Adds a file to sell as a download. The body must be multipart/form-data: send the file in a part named file (up to 200 MB), or send file_url for Comecero to fetch it (up to 500 MB live, 200 MB test). A JSON body is refused with 400. Secret and trusted tokens may call it.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Query Parameters

show?string

Comma-separated fields to return; all others are left out. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.

hide?string

Comma-separated fields to leave out of the response. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.

formatted?boolean

When true, the object also has a formatted child with amounts and dates as display text in the shopper's language and currency (for example $19.99 or November 7, 2026). The default is false. See Localized formatting.

Defaultfalse

Request Body

The file and its settings.

multipart/form-data
  1. body

A multipart/form-data body. Send the file itself in a part named file, or give file_url and Comecero fetches it. Not both, and one file per request. A direct upload may be at most 200 MB (200,000,000 bytes); for a bigger file use file_url. A file fetched from file_url may be up to 500 MB on a live account and 200 MB on a test account. All your files together may use up to 5 GB live and 500 MB test. Your account may have other limits; going over one returns 422 with the code account_limit_exceeded.

file?file

The file to upload. Its file name must be 50 characters or less. Required on create unless you send file_url. On update, a new file replaces the old one.

Formatbinary
file_url?string

A public URL Comecero downloads the file from. Not a private or local address. The file name is taken from the URL.

Formaturi
http_authorization_username?string

A user name for HTTP basic authentication on file_url, if needed.

http_authorization_password?string

The password for HTTP basic authentication on file_url.

name?string

Your name for the file. The file name is used when you leave it out.

Lengthlength <= 75
description?string

Your notes about the file.

Lengthlength <= 256
version?string

A version label, for example 2.1.

Lengthlength <= 10
expires_in_days?integer

How many days a new download link works, up to 720. The default is 7. On create it is read only when you also send expires_in_clicks, so send both.

Range0 <= value <= 720
expires_in_clicks?integer

How many clicks a new download link allows. The default is 10.

Range0 <= value

Response Body

The new file.

application/json
  1. response

A file you uploaded to sell as a download, such as an installer. Give it to a product with file_id, and each buyer gets a download link to it.

object*"file"

The object type. Always file.

Value in"file"
url*string

The URL of this file in the API.

Formaturi
file_id*string

The id of the file.

date_created*string

When the file was uploaded.

Formatdate-time
date_modified*string

When the file was last changed.

Formatdate-time
test*boolean

True for a test-mode file.

account_id*string

The account the file belongs to.

name*string

Your name for the file. The file name when you gave none.

description*|

Your notes about the file.

filename*string

The file name customers download, cleaned to letters, numbers, dashes, underscores and periods.

bytes*integer

The size of the file in bytes.

version*|

A version label, for example 2.1.

expires_in_days*integer

How many days a new download link to this file works. The default is 7.

expires_in_clicks*integer

How many clicks a new download link to this file allows. The default is 10.

formatted?

Present only when you send formatted=true.

Example Request
curl -X POST 'https://api.comecero.com/api/v1/files'
Example Response
{  "object": "file",  "url": "https://api.comecero.com/api/v1/files/0095012700001FiQ2xT7Ab",  "file_id": "0095012700001FiQ2xT7Ab",  "date_created": "2026-11-01T10:12:40Z",  "date_modified": "2026-11-01T10:12:40Z",  "test": true,  "account_id": "AB1234",  "name": "Widget Pro installer",  "description": null,  "filename": "widget-pro-setup.zip",  "bytes": 24518301,  "version": "2.1",  "expires_in_days": 7,  "expires_in_clicks": 10}