post
https://api-v2.pandavideo.com/library/
A single path that supports two distinct operations discriminated by the required ?action= query parameter.
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
POST /library/{library_id}
{library_id}A single path that supports two distinct operations discriminated by the required ?action= query parameter.
Operations Available
?action= | Operation |
|---|---|
refer | Add 1 or more allowed referrers |
referValidation | Toggle the block_none_refer policy |
?action=is required. Without it, the gateway returns405 Unsupported method.
AuthorizationRequires a valid API token in the
Authorizationheader (withoutBearerprefix). Thelibrary_idmust belong to the authenticated user.
HTTP Method & Path
POST /library/{library_id}
Base URL: https://api-v2.pandavideo.com.br
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
library_id | string (uuid v4) | yes | Library ID owned by the authenticated user |
Mode 1 — ?action=refer: Add referrers
?action=refer: Add referrersRequest Body
Content-Type: application/json
Accepts a single object or an array of objects.
| Field | Type | Required | Constraints |
|---|---|---|---|
hostname | string | yes | Regex: no http(s)://, no commas, wildcard *.example.com accepted; must contain at least one dot |
type | string | yes | Send 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)
?action=refer)- Each referrer is created with initial status:
pending(will sync with Bunny CDN) whenblock_none_refer = trueorLibrarySettingsdoes not exist yetinactivewhenblock_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 thesecuritycategory.
Success Response (200) — ?action=refer
?action=referArray 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)
?action=refer)| Status | When |
|---|---|
400 | Refer already exists — hostname already in the library (case-insensitive match) |
400 | Validation: hostname empty / malformed / missing dot |
400 | Library not found or does not belong to user |
Mode 2 — ?action=referValidation: Toggle refer policy
?action=referValidation: Toggle refer policyRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
block_none_refer | boolean | yes | true blocks requests without an allowed referer; false opens up the CDN |
{ "block_none_refer": true }Behavior (?action=referValidation)
?action=referValidation)- Setting
true: cascades existing referrers frominactive→pending(worker will re-sync them at the CDN). - Setting
false: cascades existing referrers fromactive→turning_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
?action=referValidation{ "message": "Refer policy updated successfully" }Errors (?action=referValidation)
?action=referValidation)| Status | When |
|---|---|
400 | blockNoneRefers must be a boolean |
400 | You have domains loading, please wait until they are loaded — referrers in pending / deleting / turning_inactive |
400 | Error 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
