API Key
Base URL: https://api-sls.platzi.com/production-sls-business-domains
Endpoints under /v2/api-key/auth/ let you validate an API key, generate single-use SSO magic links for users that already exist in your company, and read the structure of a course and the classes your users have viewed.
All endpoints self-authenticate via the x-platzi-company-api-key header
GET /v2/api-key/auth/validation/ - Validate API Key
Validates the API key provided in the x-platzi-company-api-key header and returns the claims associated with it.
Use this endpoint to verify that a key is active and to read the company_id, organization_id, role, and granted scope before calling other endpoints.
Request
GET /v2/api-key/auth/validation/
x-platzi-company-api-key: platzi-xxxxxxxxxxxx.xxxxxxxx...
User-Agent: <your-user-agent>
Success Response (200)
{
"data": {
"company_id": "123",
"organization_id": "10",
"user_id": "4567",
"user_profile_id": "8910",
"user_role": "company_admin",
"scope": "reports.read,sso.magiclink"
}
}
Response Fields
| Field | Description |
|---|---|
company_id | Company the key belongs to |
organization_id | Organization associated with the key |
user_id | User ID tied to the key |
user_profile_id | User profile ID tied to the key |
user_role | Role granted to the key |
scope | Comma-separated list of scopes granted to the key |
Error Response (401)
{
"errors": [
{ "error_code": "unauthorized_user", "message": "Unauthorized user" }
]
}
Returned when the header is missing, malformed, or the key has expired.
GET /v2/api-key/auth/magic-link/ - Generate SSO Magic Link
Generates a single-use magic link that logs a B2B user into Platzi without a password. Requires the API key to have the sso.magiclink scope.
The user identifier (email, username, or phone number) must be encrypted with the api_secret tied to your API key, using Fernet symmetric encryption. The api_secret is provided by Platzi organizers when the key is issued.
Request
GET /v2/api-key/auth/magic-link/?email=<encrypted-value>&only_active=true&next_url=/browse
x-platzi-company-api-key: platzi-xxxxxxxxxxxx.xxxxxxxx...
User-Agent: <your-user-agent>
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | one-of | Fernet-encrypted email. Exactly one identifier must be provided. |
username | string | one-of | Fernet-encrypted username. Only accepted when the company setting allows. |
phone_number | string | one-of | Fernet-encrypted phone number. Only accepted when the company setting allows. |
only_active | string | no | true/false (default false). If true, reject users that are not active. |
next_url | string | no | Relative path to redirect to after login (e.g. /browse). |
Identifier Rules
- Exactly one of
email,username, orphone_numbermust be supplied. Providing zero or more than one returns400. usernameandphone_numberare only accepted when the company has that setting enabled. Ask Platzi organizers if you need it.- The identifier value must be encrypted with your
api_secret(Fernet) before being sent as a query parameter.
Active User Rule (only_active=true)
When only_active=true, the user is accepted only if they are currently active in the company — i.e. fully active, or still in the invitation phase with at least one reserved/active license. Otherwise the request fails with user_not_active.
Users Invited Moments Ago
A link can be requested right after inviting a user, while their account is still being set up. The response is the same 200 with a url. If the user opens it before the setup finishes, they see a short "preparing your access" page that signs them in automatically as soon as their account is ready.
For these users only_active=true is checked when the link is opened rather than when it is requested: if the user is not active by then, they are sent to the login page instead of being signed in.
Success Response (200)
{
"data": {
"url": "https://platzi.com/sso/magic-link/verify/?token=abc123..."
}
}
The returned url is single-use and short-lived. Redirect the end user to it to complete the SSO flow.
Error Response
{
"errors": [
{
"error_code": "user_not_found",
"message": "User not found in company"
}
]
}
Error Codes
| Code | Status | Description |
|---|---|---|
missing_api_key | 401 | x-platzi-company-api-key header is missing |
invalid_api_key | 401 | API key is invalid or expired |
unauthorized_scope | 401 | API key does not include the sso.magiclink scope |
invalid_identifier | 400 | Zero or more than one identifier was provided |
identifier_not_allowed | 400 | Company does not allow username / phone_number identifiers |
decryption_failed | 400 | Identifier could not be decrypted with the key's api_secret |
user_not_found | 400 | Identifier does not match a user in the company |
user_not_active | 400 | only_active=true was set and the user is not active in the company |
user_not_ready | 409 | Rare. User was just invited and a link cannot be issued yet; retry shortly |
magic_link_generation_failed | 500 | Internal error while generating the magic link |
GET /v2/api-key/auth/magic-link/course/ - Magic Link with Course Classes
Generates one SSO magic-link token and returns it alongside the
classes inside a given course. Every class entry carries its own deep
link, built from the single token plus a next= query parameter that
points to that specific class.
Requires the API key to have the sso.magiclink scope.
Request
GET /v2/api-key/auth/magic-link/course/?email=<encrypted-value>&course_id=1234
x-platzi-company-api-key: platzi-xxxxxxxxxxxx.xxxxxxxx...
User-Agent: <your-user-agent>
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | one-of | Fernet-encrypted email. Exactly one identifier must be provided. |
username | string | one-of | Fernet-encrypted username. Only accepted when the company setting allows. |
phone_number | string | one-of | Fernet-encrypted phone number. Only accepted when the company setting allows. |
course_id | integer | yes | Numeric Core course ID. Must be a positive integer. |
Identifier and encryption rules are identical to
/v2/api-key/auth/magic-link/.
Success Response (200)
{
"data": {
"magic_link_base": "https://platzi.com/sso/magic-link/verify/?token=abc123...",
"course_id": 1234,
"classes": [
{
"material_id": 88,
"name": "Introducción",
"viewed": false,
"magic_link": "https://platzi.com/sso/magic-link/verify/?token=abc123...&next=%2Fcursos%2Freact%2Fintroduccion%2F"
}
]
}
}
Response Fields
| Field | Description |
|---|---|
magic_link_base | The single magic-link URL (no class-specific next). One-time use. |
course_id | Echoed back from the request. |
classes | Array of classes (materials) inside the course, in pedagogic order. |
material_id | Numeric class (material) ID. |
name | Class name as it appears in Platzi. |
viewed | Whether the user has viewed this class. |
magic_link | Single-use SSO URL that lands the user on this class after login. |
Notes
- The shared
magic_link_baseand every per-classmagic_linkredeem the same one-time token; thenextquery parameter is the only difference. Once the token is consumed all class links stop working. viewedreflects per-material viewed state. For a user invited moments ago whose account is still being set up, every class isviewed: false, and the links behave as described in Users Invited Moments Ago.- This endpoint does not verify that the user has access to the course (license / catalog / private course rules). Validate access upstream if your flow requires it.
- An existing course with no published classes returns
200withclasses: []and"code": -58010(see Result Codes).
Result Codes
Some outcomes also carry a numeric code at the top level of the body,
next to data or errors, so you can map each one to the message you show
your user. The rest of the body is unchanged, and responses not listed here
have no code field.
code | Status | When | Suggested message to the user |
|---|---|---|---|
-58010 | 200 | The magic link was generated but the course has no classes yet | There is no content available in this course yet |
-58011 | 404 | course_id does not match any existing course | The course could not be found |
-58012 | 500 | The magic link could not be generated | There was a problem validating your access |
{
"data": {
"magic_link_base": "https://platzi.com/sso/magic-link/verify/?token=abc123...",
"course_id": 1234,
"classes": []
},
"code": -58010
}
{
"errors": [
{
"message": "Failed to generate magic link",
"error_code": "magic_link_generation_failed"
}
],
"code": -58012
}
A request can also fail before it reaches this endpoint (for example, a
network timeout or an invalid API key rejected at the edge). Those
responses have no code; treat any non-2xx response without a code as
-58012.
Error Codes
| Code | Status | Description |
|---|---|---|
missing_api_key | 401 | x-platzi-company-api-key header is missing |
invalid_api_key | 401 | API key is invalid or expired |
unauthorized_scope | 401 | API key does not include the sso.magiclink scope |
invalid_identifier | 400 | Zero or more than one identifier was provided |
invalid_course_id | 400 | course_id is missing, non-numeric, or non-positive |
identifier_not_allowed | 400 | Company does not allow username / phone_number identifiers |
decryption_failed | 400 | Identifier could not be decrypted with the key's api_secret |
user_not_found | 400 | Identifier does not match a user in the company |
course_not_found | 404 | course_id does not match any existing course. code: -58011 |
user_not_ready | 409 | Rare. User was just invited and a link cannot be issued yet; retry shortly |
magic_link_generation_failed | 500 | Internal error while generating the magic link. code: -58012 |
GET /v2/api-key/auth/courses/{course_id}/syllabus/ - Course Structure
Returns the modules and classes of a course, in the order learners take them, plus the path of the course exam when the course has one. Use it to mirror a course in your own platform (for example, one section per module and one activity per class) without generating a magic link.
Requires the API key to have the sso.magiclink scope.
Request
GET /v2/api-key/auth/courses/1234/syllabus/
x-platzi-company-api-key: platzi-xxxxxxxxxxxx.xxxxxxxx...
User-Agent: <your-user-agent>
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
course_id | integer | yes | Course ID. Must be a positive integer. |
Success Response (200)
{
"data": {
"course_id": 1234,
"title": "Curso de React.js",
"slug": "react",
"path": "/cursos/react/",
"classes_total": 3,
"modules": [
{
"module_id": 10,
"title": "Introducción",
"position": 1,
"classes": [
{
"material_id": 88,
"name": "Bienvenida",
"type": "video",
"duration_seconds": 360,
"position": 1,
"path": "/cursos/react/bienvenida/"
},
{
"material_id": 89,
"name": "Qué vas a construir",
"type": "lecture",
"duration_seconds": 0,
"position": 2,
"path": "/cursos/react/que-vas-a-construir/"
}
]
},
{
"module_id": 12,
"title": "Hooks",
"position": 2,
"classes": [
{
"material_id": 90,
"name": "useState",
"type": "video",
"duration_seconds": 600,
"position": 3,
"path": "/cursos/react/usestate/"
}
]
}
],
"exam": { "path": "/evaluacion/555/" }
}
}
Response Fields
| Field | Description |
|---|---|
course_id | Echoed back from the request. |
title | Course title. null when it could not be read; the structure is still complete. |
slug / path | Course slug and its path on platzi.com. null when the course has no classes. |
classes_total | Number of classes across all modules. |
modules[].module_id | Module ID. Stable while the module exists. |
modules[].title | Module title. |
modules[].position | Module order, starting at 1. |
classes[].material_id | Class ID. The same ID viewed and /progress/ refer to. |
classes[].name | Class name. |
classes[].type | Kind of class: video, lecture, audio, file, iframe or simulation_class. Treat unknown values as video. |
classes[].duration_seconds | Duration in seconds. 0 when the class has no duration (for example, readings). |
classes[].position | Order of the class across the whole course, starting at 1. |
classes[].path | Path of the class on platzi.com. Pass it as next_url to /auth/magic-link/ to land the user on it. |
exam | { "path": ... } when the course has a certification exam, otherwise null. |
Notes
- Modules without classes are left out.
- A class that disappears from the response was removed from the course. Keep the learner's completion on your side; do not treat the removal as lost progress.
- This endpoint does not check that the course is in your company's
catalog. Use
GET /v3/lp-builder/{company_id}/courses/to list the courses your users can take.
Result Codes
Uses the same numbering as /auth/magic-link/course/.
code | Status | When |
|---|---|---|
-58010 | 200 | The course exists but has no classes yet (modules: []) |
-58011 | 404 | course_id does not match a course in your company's catalog or Platzi's public catalog |
-58013 | 503 | The course could not be read right now. Retry later; do not treat it as a removed course |
Error Codes
| Code | Status | Description |
|---|---|---|
missing_api_key | 401 | x-platzi-company-api-key header is missing |
invalid_api_key | 401 | API key is invalid or expired |
unauthorized_scope | 401 | API key does not include the sso.magiclink scope |
invalid_course_id | 400 | course_id is non-numeric or non-positive |
course_not_found | 404 | course_id does not match a course in your company's catalog or Platzi's public catalog. code: -58011 |
course_unavailable | 503 | Temporary failure reading the course. code: -58013. Has a Retry-After header |
course_content_failed | 500 | Internal error |
GET /v2/api-key/auth/courses/{course_id}/progress/ - Viewed Classes per User
Returns, for up to 25 users at a time, which classes of a course each one has viewed. Use it to keep class completion in sync without generating a magic link per user.
Requires the API key to have the sso.magiclink scope.
Request
GET /v2/api-key/auth/courses/1234/progress/?user_ids=501,502,503
x-platzi-company-api-key: platzi-xxxxxxxxxxxx.xxxxxxxx...
User-Agent: <your-user-agent>
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_ids | string | yes | 1 to 25 distinct Platzi user IDs, comma separated. The user_id of GET /v3/users/{company_id}. |
Success Response (200)
{
"data": {
"course_id": 1234,
"classes_total": 3,
"users": [
{ "user_id": 501, "available": true, "viewed_material_ids": [88, 90] },
{ "user_id": 503, "available": false, "viewed_material_ids": [] }
]
}
}
Response Fields
| Field | Description |
|---|---|
course_id | Echoed back from the request. |
classes_total | Number of classes the course has now. |
users[].user_id | One entry per requested user that belongs to your company, in request order. |
users[].available | false when this user's progress could not be read right now. Keep what you already have and retry later. |
users[].viewed_material_ids | IDs of the classes the user has viewed, limited to the classes the course has now. Same IDs as /syllabus/. |
Notes
- User IDs that are not current members of your company (including former members) are left out of
users. They never return data and never fail the request. available: falsewith an empty list does not mean "nothing viewed". Onlyavailable: trueentries are authoritative.- An empty
viewed_material_idswithavailable: truemeans the user has not viewed any class yet.
Result Codes
Same as /syllabus/: -58010 (course with no classes, 200),
-58011 (course not found, 404) and -58013 (course temporarily
unavailable, 503).
Error Codes
| Code | Status | Description |
|---|---|---|
missing_api_key | 401 | x-platzi-company-api-key header is missing |
invalid_api_key | 401 | API key is invalid or expired |
unauthorized_scope | 401 | API key does not include the sso.magiclink scope |
invalid_course_id | 400 | course_id is non-numeric or non-positive |
invalid_user_ids | 400 | user_ids is missing, has more than 25 IDs, repeats an ID or contains a non-positive or non-numeric value |
course_not_found | 404 | course_id does not match a course in your company's catalog or Platzi's public catalog. code: -58011 |
course_unavailable | 503 | Temporary failure reading the course. code: -58013. Has a Retry-After header |
course_content_failed | 500 | Internal error |