Create File

Create a new file by ingesting an existing URL.

For more upload options, see Uploads.


POST
/files

Authorization

AuthorizationRequiredBearer <token>

See API Security for more details.

In: header

Request Body

application/jsonRequired

The request body should contain a properly formatted JSON object with a url property. Other optional properties are listed below. See File Object for more details.

urlRequiredstring
media_idstring
folderstring
filenamestring
refstring
metadataobject

Response Body

Success

TypeScript Definitions

Use the response body type in TypeScript.

metaobject
dataobject
errorobject | null | null
linksobject
const body = JSON.stringify({
  "url": "https://ittyb.it/sample.mp4",
  "folder": "ittybit/samples",
  "filename": "video.mp4",
  "metadata": {
    "customKey2": "a different custom value"
  }
})

fetch("https://api.ittybit.com/files", {
  headers: {
    "Authorization": "Bearer <token>"
  },
  body
})
{
  "meta": {
    "request_id": "req_abcdefghij1234567890",
    "org_id": "org_abcdefgh1234",
    "project_id": "prj_abcdefgh1234",
    "version": "2025-01-01",
    "type": "object"
  },
  "data": {
    "id": "file_abcdefgh1234",
    "media_id": "med_abcdefgh1234",
    "object": "source",
    "kind": "video",
    "type": "video/mp4",
    "width": 1920,
    "height": 1080,
    "duration": 123.45,
    "filesize": 12345678,
    "folder": "ittybit/samples",
    "filename": "video.mp4",
    "url": "https://you.ittybit.net/ittybit/samples/video.mp4",
    "metadata": {
      "customKey2": "a different custom value"
    },
    "created": "2025-01-01T01:23:45Z",
    "updated": "2025-01-01T01:23:45Z",
    "status": "ready"
  },
  "error": null,
  "links": {
    "self": "https://api.ittybit.com/files/file_abcdefgh1234",
    "parent": "https://api.ittybit.com/files"
  }
}