Add library or folder referrers

A single path that supports two distinct operations discriminated by the required ?action= query parameter.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

POST /library/{library_id}

A single path that supports two distinct operations discriminated by the required ?action= query parameter.

Operations Available

?action=Operation
referAdd 1 or more allowed referrers
referValidationToggle the block_none_refer policy
🚧

?action= is required. Without it, the gateway returns 405 Unsupported method.

📘

Authorization

Requires a valid API token in the Authorization header (without Bearer prefix). The library_id must belong to the authenticated user.

HTTP Method & Path

POST /library/{library_id}

Base URL: https://api-v2.pandavideo.com.br

Path Parameters

NameTypeRequiredDescription
library_idstring (uuid v4)yesLibrary ID owned by the authenticated user

Mode 1 — ?action=refer: Add referrers

Request Body

Content-Type: application/json

Accepts a single object or an array of objects.

FieldTypeRequiredConstraints
hostnamestringyesRegex: no http(s)://, no commas, wildcard *.example.com accepted; must contain at least one dot
typestringyesSend ALLOW. Other values are accepted by validation but only ALLOW is processed
[
  { "hostname": "app.example.com", "type": "ALLOW" },
  { "hostname": "*.partner.com",  "type": "ALLOW" }
]

Side effects (?action=refer)

  • Each referrer is created with initial status:
    • pending (will sync with Bunny CDN) when block_none_refer = true or LibrarySettings does not exist yet
    • inactive when block_none_refer = false (no sync until policy turns on)
  • A message is pushed to SQS — the refer worker reconciles with Bunny CDN.
  • An audit log entry (add domain) is queued under the security category.

Success Response (200) — ?action=refer

Array of created Refer rows.

[
  {
    "id": "abc12345-e89b-12d3-a456-426614174000",
    "library_id": "123e4567-e89b-12d3-a456-426614174000",
    "type": "ALLOW",
    "url": "app.example.com",
    "status": "pending"
  }
]

Errors (?action=refer)

StatusWhen
400Refer already exists — hostname already in the library (case-insensitive match)
400Validation: hostname empty / malformed / missing dot
400Library not found or does not belong to user

Mode 2 — ?action=referValidation: Toggle refer policy

Request Body

FieldTypeRequiredDescription
block_none_referbooleanyestrue blocks requests without an allowed referer; false opens up the CDN
{ "block_none_refer": true }

Behavior (?action=referValidation)

  • Setting true: cascades existing referrers from inactivepending (worker will re-sync them at the CDN).
  • Setting false: cascades existing referrers from activeturning_inactive (worker will deactivate them at the CDN).
  • The Bunny CDN policy is updated before the DB is changed; if Bunny fails, the DB change is rolled back.

Success Response (200) — ?action=referValidation

{ "message": "Refer policy updated successfully" }

Errors (?action=referValidation)

StatusWhen
400blockNoneRefers must be a boolean
400You have domains loading, please wait until they are loaded — referrers in pending / deleting / turning_inactive
400Error on updating refer policy — Bunny CDN call failed, rollback applied

Example Usage

cURL — add referrers

curl -X POST \
  -H "Authorization: $PANDA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{"hostname":"app.example.com","type":"ALLOW"}]' \
  "https://api-v2.pandavideo.com.br/library/123e4567-e89b-12d3-a456-426614174000?action=refer"

cURL — toggle refer policy

curl -X POST \
  -H "Authorization: $PANDA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"block_none_refer":false}' \
  "https://api-v2.pandavideo.com.br/library/123e4567-e89b-12d3-a456-426614174000?action=referValidation"

Related

  • List referrers: GET /library/{library_id}?action=refer
  • Remove referrers: DELETE /library/{library_id}?action=refer
  • Update quality settings: PUT /library/{library_id} — see the page Video Qualities
Path Params
uuid
required

Unique identifier of the library

Query Params
string
enum
required

Action type

Allowed:
Body Params
string
required

Domain hostname to add as allowed referrer

string
enum
required
Allowed:
Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json