My TV Channel Scheduling API
Shape what actually airs, and when.
Operations 6
POST
/schedule/batch-insert.php
Place specific assets in the schedule manually (Pro tier and above)
#
Shape what actually airs, and when.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/my-tv-channel-com:my-tv-channel-com-scheduling-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: My TV Channel — Agent Scheduling API
version: 1.0.0
summary: Create and run 24/7 linear HLS TV channels programmatically.
description: 'Create and run 24/7 linear TV channels — the kind that just play, with no menu to browse.
Import videos, and the service transcodes them, builds a continuous schedule, and streams
the result at `https://{handle}.my-tv-channel.com` and in the iOS, iPadOS, tvOS, macOS,
Android, Fire TV and Roku apps.
## Before you start
- **Every response uses the same envelope:** `{"success": true, "data": ...}` or
`{"success": false, "error": "...", "code": N}`. There is exactly one exception, and it
is called out on the operation: `GET /channels/schedule.php` returns `data` as a bare
**array**.
- **Authentication is an API key**, `Authorization: Bearer mytv_sk_...`, created by a
signed-in human at or in the app under
Profile → Agent Access. An active subscription on any tier is required, and the key
inherits the owner''s tier limits. **An agent cannot mint its own key, by design** — if
you do not have one, ask the owner for one.
- **Rate limit:** 1,000 requests/hour per key. Exceeding it returns `429` with
`Retry-After`; honour it rather than spinning.
- **Start with `GET /users/status.php`.** It returns the tier, the real quota numbers for
this account, every channel, and for each one exactly what it still needs before it can
go live. Agents that skip this step guess, and guessing is expensive.
## The two things that catch everyone
1. **Weights only reach the air when the schedule is generated.** A channel builds its
schedule the instant it crosses the launch threshold, from the weights present at that
moment. Weights set afterwards are stored faithfully, reported back correctly, and do
not change what is broadcasting. Either set each asset''s weight as soon as it reports
`ready`, or call `POST /schedule/regenerate.php` when you are done.
2. **You cannot upload a local file over MCP**, because tool arguments are JSON and there
is no multipart channel. `POST /assets/import-url.php` is therefore the ingestion path
for an agent. `POST /assets/upload.php` exists for clients that can post multipart.
## Going live
A channel launches **automatically** once it has ≥ 4 ready assets **and** ≥ 15 minutes of
content with weight > 0. Transcoding is the slow step. Poll `GET /assets/status.php` for
`summary.meetsLaunchRequirements`, then `GET /channels/get.php` until `scheduleStatus` is
`active`, then report the watch URL to the owner.'
contact:
name: My TV Channel
url: https://my-tv-channel.com/agents/
license:
name: Proprietary
url: https://my-tv-channel.com/terms.html
servers:
- url: https://my-tv-channel.com/api/mytvchannel
description: Production (canonical host)
- url: https://my-tv-channel.com/api/mytvchannel
description: Production (legacy host, still live — prefer the canonical one)
security:
- bearerAuth: []
tags:
- name: Scheduling
description: Shape what actually airs, and when.
paths:
/channels/schedule.php:
get:
operationId: getSchedule
tags:
- Scheduling
summary: The EPG for a channel
description: 'Returns the electronic programme guide — what is playing and what is next.
**Two things are unlike every other endpoint here.** This one needs **no
authentication**, because an EPG is public; and its `data` is a **bare array**, not an
object. If you wrote a generic response handler that reaches into `data.something`, it
will break precisely here.'
security: []
parameters:
- name: channel_id
in: query
required: true
schema:
type: integer
responses:
'200':
description: EPG entries, oldest first
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
type: array
items:
$ref: '#/components/schemas/ScheduleEntry'
/schedule/regenerate.php:
post:
operationId: regenerateSchedule
tags:
- Scheduling
summary: Rebuild the schedule now, with the current weights
description: '**Call this after changing weights on a channel that is already live**, or the change
will not air until the hourly cron picks it up.
Destructive in the sense that it replaces what was going to air — but not
irreversible; it rebuilds from current state. Manual rows placed by
`POST /schedule/batch-insert.php` survive regeneration.
Throttled to **one call per channel per 5 minutes**. On `429`, honour `Retry-After`;
do not spin.'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- channel_id
properties:
channel_id:
type: integer
responses:
'200':
description: Schedule rebuilt
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSuccess'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
/schedule/batch-insert.php:
post:
operationId: batchInsertSchedule
tags:
- Scheduling
summary: Place specific assets in the schedule manually (Pro tier and above)
description: Manual placement. Requires **Pro tier or above** — check `tier` from `GET /users/status.php` first and tell the owner an upgrade is needed rather than retrying into `403`. Rows placed this way survive schedule regeneration.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- channelId
- assetIds
- mode
properties:
channelId:
type: integer
assetIds:
type: array
items:
type: integer
mode:
type: string
enum:
- end
- at_time
startTime:
type: string
description: Required when `mode` is `at_time`.
responses:
'200':
description: Inserted
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSuccess'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/TierRequired'
/schedule/validate.php:
post:
operationId: validateScheduleRules
tags:
- Scheduling
summary: Dry-run a ruleset — saves nothing
description: '**Always call this before `PUT /schedule/rules.php`.** It takes exactly the payload
that `rules.php` accepts, **saves nothing**, and returns
`{valid, errors[], warnings[], preview[]}` including a simulated 24-hour grid.
Deliberately **not tier-gated**, so you can preview a ruleset on any plan — including
one the owner could not yet commit.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RuleSet'
responses:
'200':
description: Validation result and a simulated 24-hour grid
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ApiSuccess'
- type: object
properties:
data:
type: object
properties:
valid:
type: boolean
errors:
type: array
items:
type: string
warnings:
type: array
items:
type: string
preview:
type: array
items:
type: object
'401':
$ref: '#/components/responses/Unauthorized'
/schedule/rules.php:
get:
operationId: getScheduleRules
tags:
- Scheduling
summary: The current ruleset for a channel
parameters:
- name: channel_id
in: query
required: true
description: '`id` is also accepted.'
schema:
type: integer
responses:
'200':
description: The ruleset
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ApiSuccess'
- type: object
properties:
data:
$ref: '#/components/schemas/RuleSet'
'401':
$ref: '#/components/responses/Unauthorized'
put:
operationId: setScheduleRules
tags:
- Scheduling
summary: Replace the whole ruleset (Pro tier and above)
description: '**This REPLACES the entire ruleset**, it does not merge. Read the current rules first
if you intend to add one, and always run `POST /schedule/validate.php` on the payload
before committing it.
Requires **Pro tier or above**. Rules are durable intent: the scheduler re-honours
them every time it rebuilds, so you compile the owner''s wishes once rather than
babysitting the grid.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RuleSet'
responses:
'200':
description: Ruleset replaced
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSuccess'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/TierRequired'
components:
schemas:
ApiError:
type: object
required:
- success
- error
properties:
success:
type: boolean
const: false
error:
type: string
description: Human-readable. For the YouTube ownership failure this string contains the exact tag the owner must publish — relay it verbatim.
code:
type: integer
RuleSet:
type: object
required:
- channel_id
- rules
properties:
channel_id:
type: integer
timezone:
type: string
description: IANA name, e.g. `Europe/Paris`. **Set this** — rule times are wall clock in the channel timezone, and omitting it means UTC, which is almost never what the owner meant. `schedule_timezone` is also accepted.
examples:
- Europe/Paris
rules:
type: array
items:
$ref: '#/components/schemas/Rule'
ScheduleEntry:
type: object
properties:
id:
type: integer
channelId:
type: integer
assetId:
type: integer
title:
type: string
startTime:
type: string
endTime:
type: string
durationSeconds:
type: number
isLive:
type: boolean
hlsUrl:
type: string
format: uri
Rule:
type: object
required:
- rule_type
- start_time
- days_mask
- selector_type
- selector_value
description: 'A `time_slot` puts something on at a time. A `daypart_weight` changes how likely
something is during a window.
**Slots start ON-OR-AFTER their time.** The programme running into a slot is never cut
short, so an 18:00 slot may actually begin at 18:02. That is deliberate — a linear
channel must not chop a video in half to hit a clock time. Do not report it as a fault.
'
properties:
rule_type:
type: string
enum:
- time_slot
- daypart_weight
start_time:
type: string
pattern: ^([01][0-9]|2[0-3]):[0-5][0-9]$
examples:
- '18:00'
end_time:
type: string
pattern: ^([01][0-9]|2[0-3]):[0-5][0-9]$
description: 'On a `time_slot`, this makes it a **block**: it keeps drawing from the selector until this time. Without it you get a single programme, not a morning of cartoons.'
days_mask:
type: integer
minimum: 0
maximum: 127
description: Bitmask — bit0=Mon, bit1=Tue … bit6=Sun. `127` = every day, `31` = Mon–Fri, `96` = weekend.
examples:
- 127
- 31
- 96
selector_type:
type: string
enum:
- asset
- tag
- playlist
selector_value:
description: An asset id, a tag string, or — for `playlist` — an array of asset ids, which play in order.
oneOf:
- type: integer
- type: string
- type: array
items:
type: integer
priority:
type: integer
default: 0
weight_multiplier:
type: number
minimum: 0
maximum: 10
description: '`daypart_weight` only. `0` removes matching assets from that window entirely.'
ApiSuccess:
type: object
required:
- success
properties:
success:
type: boolean
const: true
message:
type: string
data: {}
responses:
TierRequired:
description: This operation needs a higher subscription tier. Check `tier` from `GET /users/status.php` before calling rather than discovering it here.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
BadRequest:
description: Malformed request or a rejected value
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
Unauthorized:
description: Missing, malformed or revoked API key
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
RateLimited:
description: Rate limit or throttle exceeded — 1,000 requests/hour per key, and separately one schedule regeneration per channel per 5 minutes. Honour `Retry-After`; do not spin.
headers:
Retry-After:
schema:
type: integer
description: Seconds to wait before retrying.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'An API key, `Authorization: Bearer mytv_sk_...`. Created by a signed-in human at
<https://my-tv-channel.com/agent-keys/> or in the app under Profile → Agent Access.
Requires an active subscription on any tier; the key inherits the owner''s tier limits.
Key management — creating and revoking — is deliberately impossible with an API key,
so an agent holding one cannot escalate to issuing more. **Never ask the owner for
their Apple password or app login.** The key is all you need.
'
externalDocs:
description: Agent guide, with a worked path from nothing to a broadcasting channel. Read this if the spec alone leaves you unsure what order to call things in.
url: https://my-tv-channel.com/api/mytvchannel/docs/AGENTS.md