Create Media

Create a new media object.

Media created in this way will be empty. You can add either new or existing files using the Files endpoints.


POST
/media

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 one or more of title, alt, or metadata properties. See Media Object for more details.

titlestring
altstring
metadataobject

Response Body

Success

TypeScript Definitions

Use the response body type in TypeScript.

metaobject
dataobject
errorobject | null | null
linksobject
const body = JSON.stringify({
  "title": "My Video Example",
  "alt": "An example video used to demonstrate the ittybit API",
  "metadata": {
    "customKey2": "a different custom value"
  }
})

fetch("https://api.ittybit.com/media", {
  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": "med_abcdefgh1234",
    "object": "media",
    "kind": null,
    "title": "My Video Example",
    "alt": "An example video used to demonstrate the ittybit API",
    "files": [],
    "urls": {},
    "background": null,
    "metadata": {
      "customKey": "your custom value"
    },
    "created": "2025-01-01T01:23:45Z",
    "updated": "2025-01-01T01:23:45Z"
  },
  "error": null,
  "links": {
    "self": "https://api.ittybit.com/media/med_abcdefgh1234",
    "parent": "https://api.ittybit.com/media"
  }
}