Metadata

View Markdown

Introduction

Metadata is a key-value store available on Tasks and Runs. It lets you attach your own data to resources for tracking, filtering, or identification.

For example, you might store the uploader's user_id to identify who triggered the task.

{
  "id": "task_abcdefgh12345678",
  "object": "task",
  "kind": "video",
  "metadata": {
    "user_id": "abcd-1234-efgh-5678",
    "username": "@totallyrealperson"
  }
}

Usage

Keys

  • You can add up to 32 keys per object
  • Metadata keys can be up to 32 characters
  • Metadata keys must contain only letters, numbers and underscores
  • Keys must use UTF-8 encoding

Values

  • Metadata values must be 2048 characters or fewer
  • Metadata values must be strings. If you need to use non-string values in your application, you will need to parse them (e.g. const episodeNumber = parseInt(metadata.episode))
  • Values must use UTF-8 encoding

Be careful when checking boolean values. Because metadata values are strings, you will need to check for "true" or "false" instead of true or false.

Adding metadata

Include a metadata object when creating a task or run:

{
  "url": "https://example.com/video.mp4",
  "kind": "video",
  "metadata": {
    "user_id": "user_123",
    "source": "upload"
  }
}

You can also add metadata to individual tasks within a Run or Workflow:

{
  "tasks": [
    {
      "kind": "ingest",
      "options": { "url": "https://example.com/video.mp4" },
      "next": [
        {
          "kind": "image",
          "metadata": { "ref": "poster" },
          "options": { "width": 1280, "format": "jpeg" }
        },
        {
          "kind": "image",
          "metadata": { "ref": "preview" },
          "options": { "width": 320, "format": "jpeg" }
        }
      ]
    }
  ]
}

API Reference

API Reference

On this page