Prompt
Secure video delivery with signed URLs API
Latest observation
Nov 1, 2026
OpenAI APIWeb search: off
Here’s a practical API design for secure video delivery using signed URLs.
Goal
Allow only authorized users to access video files, without exposing the origin directly.
Typical flow
- Client authenticates with your API.
- Client requests a playback URL for a specific video.
- API checks authorization.
- API returns a short-lived signed URL.
- Client uses that URL to stream the video directly from storage/CDN.
- URL expires after a short time.
Example API endpoints
1) Request a signed playback URL
POST /api/videos/{videoId}/playback-url
Authorization: Bearer <access_token>
Content-Type: application/json
Response
{
"videoId": "vid_123",
"playbackUrl": "https://cdn.example.com/videos/vid_123/playlist.m3u8?exp=1735689600&sig=abc123",
"expiresAt": "2024-12-31T12:00:00Z"
}
If using direct file download
GET /api/videos/{videoId}/download-url
Authorization: Bearer <access_token>
Response
{
"downloadUrl": "https://storage.example.com/private/video.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
"expiresAt": "2024-12-31T12:00:00Z"
}
Signed URL best practices
- Use short expiration: 1–10 minutes for playback.
- Include only necessary claims in the signature:
- resource path
- expiry timestamp
- optional IP/user binding
- Use HTTPS only
- Prefer CDN or storage-native signed URL mechanisms
- For HLS/DASH, sign:
- master playlist
- variant playlists
- segments, if required
- Rotate signing keys regularly
- Log issuance and access attempts
- Return
403when authorization fails or URL is expired
HMAC-signed URL example
URL format
https://cdn.example.com/videos/vid_123/playlist.m3u8?exp=1735689600&user=42&sig=BASE64_SIGNATURE
Signature input
GET\n/videos/vid_123/playlist.m3u8\nexp=1735689600&user=42
Server verification
- Recompute signature using shared secret
- Compare signatures securely
- Reject if expired or tampered
Recommended response codes
200 OK— signed URL issued401 Unauthorized— not logged in403 Forbidden— not allowed to access video404 Not Found— video does not exist429 Too Many Requests— rate limit exceeded
Extra security options
- Bind URL to a user ID or session ID
- Restrict by IP address
- Use one-time tokens for highly sensitive content
- Require token exchange before issuing signed URL
- Use DRM for stronger protection if needed
Minimal OpenAPI example
paths:
/api/videos/{videoId}/playback-url:
post:
summary: Get signed playback URL
security:
- bearerAuth: []
parameters:
- name: videoId
in: path
required: true
schema:
type: string
responses:
'200':
description: Signed URL returned
content:
application/json:
schema:
type: object
properties:
playbackUrl:
type: string
expiresAt:
type: string
format: date-time
'401':
description: Unauthorized
'403':
description: Forbidden
If you want, I can also provide:
- a Node.js implementation,
- an AWS S3 + CloudFront signed URL setup, or
- a more complete OpenAPI spec.
Brands