YA-Planning API documentation
Integrate timetable generation and viewing, manage your establishments' configuration and receive real-time events. Full reference, examples and sandbox.
Introduction
The API is REST, JSON, versioned. All business resources live under the prefix /api/v1/pub/v1. Public demo endpoints are under /api/v1/public/api-demo.
- Base URL:
https://your-domain/api/v1/pub/v1 - Format: requests and responses in
application/json(except ICS/PDF exports). - Versioning: the version is in the path (
/v1); backward-compatible additions do not change the version. - CORS: the public API is open to third-party browser applications (without cookies).
Authentication
Each request carries an API key, in one of two headers:
X-API-Key: yap_live_xxxxxxxxxxxxxxxxxxxx
# ou
Authorization: Bearer yap_live_xxxxxxxxxxxxxxxxxxxxA key can be authorized for several establishments (enterprise key). In that case specify the target via the X-Etablissement-Id header; if only one establishment is authorized, it is inferred automatically. Keys are created, with scopes, in the console.
Environments & sandbox
Two environments, distinguished by the key prefix:
yap_live_…— production: your real data; generation counts against the weekly quota.yap_test_…— sandbox: reads return a demo dataset (never your real data), generation is not counted, and configuration writes are rejected (SANDBOX_READONLY). Ideal for developing without risk.
Scopes
Each key carries a subset of scopes; an endpoint rejects (403 INSUFFICIENT_SCOPE) if the required scope is missing.
config:read | Read cycles, classes, subjects, teachers, slots, hourly volumes. |
config:write | Create / edit / delete the establishment configuration. |
timetables:read | List jobs, read results and published timetables, export. |
timetables:write | Launch a generation and publish a timetable. |
webhooks:manage | Create, list and delete webhook endpoints. |
establishments:manage | Create and list your own establishments (account level, without X-Etablissement-Id). |
Rate & quotas
Each key has a rate limit (60 req/min by default). Responses carry:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1783919311 # epoch (s) de réinitialisationExceeding it returns 429 RATE_LIMITED with the Retry-After header. Timetable generation is additionally subject to the plan's weekly quota (visible via /me).
Every API response also carries an X-Request-Id header (correlation id) — share it with support in case of an incident. Note: rate counting is currently applied per instance; on a multi-instance deployment the effective limit may be a multiple of the displayed value.
Errors
Uniform error envelope, with a requestId for support:
{ "error": "INSUFFICIENT_SCOPE", "message": "Scope requis : config:write.",
"requestId": "6181762d-…", "requiredScope": "config:write" }| Code | error | Cause |
|---|---|---|
| 400 | BAD_REQUEST | Missing or invalid parameters. |
| 401 | UNAUTHORIZED / INVALID_API_KEY | Missing, invalid or revoked key. |
| 403 | INSUFFICIENT_SCOPE | The key lacks the required scope. |
| 403 | ETABLISSEMENT_NOT_GRANTED | The key is not authorized for the requested establishment. |
| 403 | SANDBOX_READONLY | Writing forbidden with a sandbox key (read-only). |
| 402 | PLAN_UPGRADE_REQUIRED | Feature reserved for a paid plan (e.g. iCal export). |
| 404 | NOT_FOUND | Resource does not exist or is outside your establishment. |
| 409 | WORKFLOW_ERROR | Workflow transition impossible (e.g. publishing a draft). |
| 429 | RATE_LIMITED | Rate exceeded — retry after the Retry-After header. |
Test live — no sign-up
Public demo endpoints (no key required).
Postman: “Import” → “Link” → paste /q/openapi?format=json.
Reference — Account & introspection
/meDetails of the current key: environment, target establishment, granted scopes and remaining generation quota. No scope required.
{
"environment": "LIVE",
"etablissementId": "61a9…8cb",
"scopes": ["config:read", "timetables:write"],
"entitlements": {
"plan": "PRO",
"generationsRestantes": -1,
"resetLe": "2026-07-14T00:00:00Z",
"maxClassesExport": -1
}
}/me/etablissementPublic profile of the target establishment: name, acronym, city, country, type, website. No scope required.
{"id":"…","nom":"Groupe Scolaire Les Palmiers","slug":"gs-palmiers","sigle":"GSP","ville":"Abidjan","pays":"CI","type":"PRIVE","siteWeb":"https://…"}/me/usageRecent usage of the current key (calls and errors per day). No scope required.
days— window in days (default 30, max 90)
{"apiKeyId":"…","days":30,"daily":[{"day":"2026-07-12","calls":128,"errors":3}]}Reference — Account — establishments
Account-level provisioning: create your own establishments WITHOUT the X-Etablissement-Id header (the /account path is not tied to an establishment). Scope establishments:manage. On creation, the calling key automatically receives an ACTIVE grant on the new establishment — then use X-Etablissement-Id to configure and generate.
/account/etablissementsestablishments:manageCreate an establishment (developer bucket, subject to your account's cap).
{"nom":"Groupe Scolaire Les Palmiers","type":"PRIVE_LAIC","pays":"CI"}{"id":"…","nom":"Groupe Scolaire Les Palmiers","slug":"gs-les-palmiers","pays":"CI","type":"PRIVE_LAIC"}/account/etablissementsestablishments:manageList the establishments you have created.
[{"id":"…","nom":"…","slug":"…","pays":"CI","type":"PRIVE_LAIC"}]Reference — Configuration
Pedagogical structure of the establishment. Read: scope config:read. Write: scope config:write (forbidden in sandbox). A freshly created establishment already contains a “Main cycle”.
/cyclesconfig:readList of cycles.
[{"id":"…","libelle":"Cycle principal","ordre":0}]/cyclesconfig:writeCreate a cycle.
{"libelle":"Second cycle","ordre":1}/cycles/{id}config:writeDelete a cycle.
/niveauxconfig:readList of classes/levels.
[{"id":"…","libelle":"6ème 1","cycleId":"…","effectif":42,"ordre":1}]/niveauxconfig:writeCreate a class.
{"libelle":"6ème 3","cycleId":"<uuid-cycle>","effectif":40,"ordre":3}/niveaux/{id}config:writeEdit a class (partial fields).
/niveaux/{id}config:writeDelete a class.
/disciplinesconfig:readList of subjects.
[{"id":"…","libelle":"Mathématiques","code":"MATH","couleur":"#6C5CE7","ordre":1}]/disciplinesconfig:writeCreate a subject.
{"libelle":"Physique-Chimie","code":"PC","couleur":"#00B894","ordre":5}/disciplines/{id}config:writeEdit a subject.
/disciplines/{id}config:writeDelete a subject.
/professeursconfig:readList of teachers.
[{"id":"…","nom":"Koné","prenoms":"Awa","matricule":"P-0142","email":"…","telephone":"…","nombreHeureAutorise":18,"statut":"TITULAIRE","actif":true}]/professeursconfig:writeCreate a teacher.
{"nom":"Diarra","prenoms":"Sékou","matricule":"P-0210","email":"s.diarra@ecole.ci","nombreHeureAutorise":18,"statut":"VACATAIRE","actif":true}/professeurs/{id}config:writeEdit a teacher.
/professeurs/{id}config:writeDelete a teacher.
/horairesconfig:readTime slots of the grid.
[{"id":"…","jour":"MONDAY","heureDebut":"08:00","heureFin":"09:00","estPause":false,"libelle":null}]/horairesconfig:writeCreate a slot (day, HH:mm).
{"jour":"MONDAY","heureDebut":"08:00","heureFin":"09:00","estPause":false,"libelle":"M1"}/horaires/{id}config:writeDelete a slot.
/volumesconfig:readHourly volumes (subject × cycle).
[{"id":"…","cycleId":"…","disciplineId":"…","nombreHeuresObligatoire":4,"minHeuresConsecutives":1,"maxHeuresConsecutives":2}]/volumesconfig:writeCreate an hourly volume.
{"cycleId":"<uuid>","disciplineId":"<uuid>","nombreHeuresObligatoire":4,"minHeuresConsecutives":1,"maxHeuresConsecutives":2}/volumes/{id}config:writeDelete an hourly volume.
Reference — Timetables
Asynchronous generation (the solver runs in the background — poll the status), publication and viewing. In sandbox, generation uses a demo dataset and is not counted against the quota.
/timetables/generatetimetables:writeLaunches a generation. Returns 202 + a jobId to poll. LIVE counts against the weekly quota. Optional Idempotency-Key header: the same identifier replays the stored response (response marked Idempotency-Replayed: true) instead of launching a new generation.
Idempotency-Key— header (optional) — idempotency key on the LIVE side
{"durationMinutes": 5}{"jobId":"…","status":"SOLVING_SCHEDULED"}/timetables/jobstimetables:readPaginated list of jobs.
page— page index (default 0)size— size (default 25, max 100)
{"items":[{"jobId":"…","name":"…","status":"SOLVING_ENDED","workflowStatus":"BROUILLON","feasible":true,"hardScore":0,"softScore":-42,"createdAt":"…"}],"total":7,"page":0,"size":25}/timetables/jobs/{jobId}timetables:readStatus of a job.
/timetables/jobs/{jobId}/resulttimetables:readResult: list of lessons (once status = SOLVING_ENDED).
{"jobId":"…","status":"SOLVING_ENDED","feasible":true,"lessons":[{"id":"1","matiere":"Maths","niveau":"6ème 1","professeur":"M. Koné","jour":"MONDAY","debut":"08:00:00","fin":"09:00:00","couleur":"#6C5CE7","niveauOrdre":1,"verrouille":false}]}/timetables/jobs/{jobId}/publishtimetables:writePublishes the timetable (workflow → PUBLIE). Triggers the timetable.published webhook event.
/timetables/published/latesttimetables:readLatest published timetable of the establishment.
/timetables/published/{jobId}/classestimetables:readLabels of the classes present in a published timetable.
{"classes":["6ème 1","6ème 2","5ème 1"]}/timetables/published/{jobId}/classe/{niveau}timetables:readLessons of a class in a published timetable.
/timetables/jobs/{jobId}/export.icstimetables:readiCalendar export (text/calendar). Reserved for the Pro plan → 402 otherwise.
niveau— filter on a classprofesseur— filter on a teacher
/timetables/jobs/{jobId}/export.pdftimetables:readPDF export (application/pdf) — the whole cohort, by class or by teacher.
mode— all | class | teacherniveau— required if mode=classprofesseur— required if mode=teacher
Reference — Webhooks
Receive signed events. Scope webhooks:manage. The secret is only returned on creation (or after rotation). Events: timetable.job.completed, timetable.job.failed, timetable.published, webhook.test. Each delivery is signed (HMAC-SHA256) and replayed up to 5 times on failure. The URL is validated against SSRF (internal/private targets rejected).
/webhookswebhooks:manageList of endpoints.
/webhookswebhooks:manageCreate an endpoint. Returns the signing secret (keep it).
{"url":"https://exemple.com/webhooks/yap","events":["timetable.published","timetable.job.completed"]}{"endpoint":{"id":"…","url":"…","events":["timetable.published"],"active":true},"secret":"whsec_…"}/webhooks/{id}webhooks:manageDelete an endpoint.
/webhooks/{id}/deliverieswebhooks:manageDelivery log (status, HTTP code, attempts).
/webhooks/{id}/rotatewebhooks:manageRegenerate the signing secret (returned only once).
{"endpoint":{"id":"…","url":"…"},"secret":"whsec_…"}/webhooks/{id}/testwebhooks:manageSend a webhook.test event to the endpoint (202 + status queued).
/webhooks/deliveries/{deliveryId}/replaywebhooks:manageReplay a past delivery (202 + status queued).
Reference — Demo (public, no key)
Public unauthenticated endpoints to discover the shape of the responses.
/api/v1/public/api-demo/previewPreview of a demo establishment (cycles, classes, subjects, teachers, slots).
/api/v1/public/api-demo/sample-timetableSample lessons (shape of a generated timetable).
Webhooks — verify a signature
Each delivery is a JSON POST with the headers X-Webhook-Event, X-Webhook-Timestamp and X-Webhook-Signature = HMAC-SHA256(timestamp + "." + body, secret). Verify the signature and the freshness of the timestamp (under 5 min) to prevent replay. Events: timetable.published, timetable.job.completed, timetable.job.failed, webhook.test.
POST https://votre-app/webhook
X-Webhook-Event: timetable.published
X-Webhook-Timestamp: 1712345678
X-Webhook-Signature: 9f86d081…
{ "event":"timetable.published", "jobId":"…", "etablissementId":"…", "occurredAt":"…" }import crypto from "crypto";
// Express — vérifier la signature d'un webhook YA-Planning
app.post("/webhooks/yap", express.raw({ type: "*/*" }), (req, res) => {
const ts = req.header("X-Webhook-Timestamp");
const sig = req.header("X-Webhook-Signature");
const body = req.body.toString("utf8");
const expected = crypto.createHmac("sha256", process.env.YAP_WEBHOOK_SECRET)
.update(`${ts}.${body}`).digest("hex");
// fraîcheur (anti-rejeu) : < 5 min
const fresh = Math.abs(Date.now()/1000 - Number(ts)) < 300;
if (!fresh || !crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)))
return res.sendStatus(400);
const event = JSON.parse(body); // { event, jobId, etablissementId, occurredAt }
res.sendStatus(200);
});Code examples
# Vérifier ses droits
curl https://votre-domaine/api/v1/pub/v1/me \
-H "X-API-Key: yap_live_xxxxxxxxxxxx"
# Générer un EDT puis suivre le job
JOB=$(curl -s -X POST .../api/v1/pub/v1/timetables/generate \
-H "X-API-Key: yap_live_xxxx" -H "Content-Type: application/json" \
-d '{"durationMinutes":5}' | jq -r .jobId)
curl .../api/v1/pub/v1/timetables/jobs/$JOB \
-H "X-API-Key: yap_live_xxxx"Versions & deprecation
The API is versioned in the path (/api/v1/pub/v1/…). We add fields and endpoints in a backward-compatible way; these additions are not a breaking change, so code tolerantly (ignore unknown fields). Any breaking change will result in a new major version and at least 90 days notice, announced via the Deprecation response header and the changelog below.
2026-07— Developer accounts & dashboard; account-level provisioning (POST /account/etablissements, scopeestablishments:manage);/cyclesendpoints; PDF exportmode=teacher.2026-07— Idempotency-Key on generation;/me/etablissement,/me/usageendpoints; webhook rotation / test / replay;timetable.job.failedevent;X-Request-Idheader; pagination of configuration lists; key expiration and IP restriction; anti-SSRF validation of webhook URLs.2026-06— Launch of public API v1: scoped keys, configuration, timetable generation & publication, signed webhooks, sandbox, quota headers.
Ready to integrate?
Create a sandbox key in 30 seconds and make your first call.
Open the API console