uploadxDocs
Esc

    Upload a file

    Create a file record, send its bytes to the upload link, and get a signed link to download it.

    An upload takes two requests: one to create the record and get an upload link, one to send the bytes to that link. The TypeScript SDK does both in one call.

    1. Create the record

    HTTP
    POST /v1/files
    Field Type Description
    originalName string The file name to store
    mimeType string The media type, for example video/mp4
    size number Exact size in bytes. The upload must match it
    Terminal
    curl https://api.uploadx.in/v1/files \
      -H "Authorization: Bearer $UPLOADX_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "originalName": "onboarding.mp4", "mimeType": "video/mp4", "size": 18400000 }'

    The response is the file record plus where to send the bytes:

    JSON
    {
      "id": "2f9k7c1e-6b3d-4a8f-9c2e-7d4b1a6e3f50",
      "originalName": "onboarding.mp4",
      "mimeType": "video/mp4",
      "size": 18400000,
      "ext": "mp4",
      "uploadVia": "API",
      "createdAt": "2026-10-18T09:12:44.000Z",
      "updatedAt": "2026-10-18T09:12:44.000Z",
      "uploadUrl": "https://api.uploadx.in/v1/files/2f9k7c1e-6b3d-4a8f-9c2e-7d4b1a6e3f50/content?expires=1792321664&sig=…",
      "expiresIn": 900
    }

    2. Send the bytes

    PUT the file to uploadUrl within expiresIn seconds. The link carries its own signature, so send no Authorization header:

    Terminal
    curl -X PUT "$UPLOAD_URL" \
      -H "Content-Type: video/mp4" \
      --data-binary @onboarding.mp4

    The body must be exactly size bytes. The response is the file record, now stored.

    If this step fails, delete the record with DELETE /v1/files/bulk and start again. A record whose bytes never arrive stops counting against your storage once its link expires.

    HTTP
    GET /v1/files/:id/url
    Terminal
    curl https://api.uploadx.in/v1/files/2f9k7c1e-6b3d-4a8f-9c2e-7d4b1a6e3f50/url \
      -H "Authorization: Bearer $UPLOADX_API_KEY"
    JSON
    {
      "url": "https://api.uploadx.in/v1/files/2f9k7c1e-…/content?expires=…&sig=…",
      "name": "onboarding.mp4",
      "expiresIn": 900
    }

    Anyone holding url can download the file until it expires, so hand it to a browser, curl, or a CDN. Ask for a fresh one each time.

    The file record

    Every file, however it was uploaded, is described by the same record.

    Field Type Description
    id string The file’s ID
    originalName string The file name, as uploaded
    mimeType string The media type, for example image/png
    size number Size in bytes
    ext string The extension, without the dot
    uploadVia string API for uploads with a key, WEB for the dashboard
    createdAt string When it was created, as an ISO 8601 timestamp
    updatedAt string When it last changed, as an ISO 8601 timestamp

    Limits

    • File size. The largest file you can send depends on your plan; see Limits. Larger files are rejected before anything is stored.
    • Storage. If the file would take your account past its storage, step 1 fails with 400 and nothing is stored:
    JSON
    { "error": "bad_request", "message": "Insufficient storage" }

    Free space by deleting files, or move to a bigger plan.