Docs

API integration

Forward Chunkify webhooks to your local server and call the Chunkify API from your terminal.

Receiving Webhooks Notifications Locally

Use chunkify listen to forward webhook notifications to your local server. For example, test how your application handles a video Asset becoming playable or finishing preparation.

First, you need to retrieve your webhook secret in your project settings page under the Webhooks section.

webhook secret

Start forwarding webhooks to your local server:

chunkify listen \
  --forward-to http://localhost:3000/webhooks/chunkify \
  --webhook-secret <secret-key> \
  --events asset.playback_ready,asset.ready,asset.failed

  ██   ▗▄▄▖▗▖ ▗▖▗▖ ▗▖▗▖  ▗▖▗▖ ▗▖▗▄▄▄▖▗▄▄▄▖▗▖  ▗▖
██    ▐▌   ▐▌▄▐▌▐▌ ▐▌▐▛▚▖▐▌▐▌▗▞▘  █  ▐▌▗▖  ▝▚▞▘
  ██  ▝▚▄▄▖▐▌ ▐▌▝▚▄▞▘▐▌  ▐▌▐▌ ▐▌▗▄█▄▖▐▌     ▐▌

Chunkify CLI version: dev
https://chunkify.dev

────────────────────────────────────────────────

[mac.home] Start forwarding to http://localhost:3000/webhooks/chunkify

Events:
- asset.playback_ready
- asset.ready
- asset.failed

────────────────────────────────────────────────

[200 OK] notf_33f3pVlO3782tPF9CkioGK1IKTu asset.playback_ready (ast_33f3ocg9Vg0o0gDgg5JpCCR3DzX)
[200 OK] notf_33f3tiGWDw78SLHefdswGaL7UpB asset.ready (ast_33f3ocg9Vg0o0gDgg5JpCCR3DzX)

Without --events, the CLI forwards every event your project can receive, including asset.*, asset.output.*, workflow_run.*, upload.*, source.*, transcoding.*, and thumbnail.*. See Events for the full list.

Use --events to choose which notifications to forward. Unknown event names are rejected. For example, listen only for an Asset becoming playable or failing:

chunkify listen \
  --forward-to http://localhost:3000/webhooks/chunkify \
  --webhook-secret <secret-key> \
  --events asset.playback_ready,asset.failed

What chunkify listen does under the hood:

  • Creates a temporary webhook in your project
  • Forwards all notifications to your local server
  • Signs requests with the webhook secret key
  • Cleans up the webhook when you exit

Calling the API

Use chunkify api <resource> <action> to call the Chunkify API. These commands print the API's JSON response to standard output, so you can pipe them to tools such as jq:

chunkify api assets list --query limit=10 | jq '.data'
chunkify api transcodings get trn_33f3ocg9Vg0o0gDgg5JpCCR3DzX
chunkify api projects update my-project --data '{"name":"New name"}'
chunkify api storages create --data @storage.json

The CLI discovers resources and actions from the OpenAPI specification. Run chunkify api --help to list resources and chunkify api assets --help to list a resource's actions.

  • Path IDs follow the action name, as shown by each command's --help output.
  • Repeat --query key=value for multiple query parameters.
  • Use --data @file.json or --data @- to send a JSON body from a file or standard input.
  • Errors are printed as JSON on standard error, with a nonzero exit status.

Project resources use the project token. Projects and access tokens require a team token:

chunkify config team-token <sk_team_token>
chunkify api projects list

You can also set CHUNKIFY_TEAM_TOKEN in the environment. Both tokens can be saved under the same --profile.