Authenticate to the Learn Schools API with an API key

Automatic translation. View original

The Schools API allows access to resources from the Learn panel /admin in JSON format using an API key. Each request acts with the identity and permissions of the administrator associated with that key.

This guide explains how to authenticate an integration. The methods, parameters, and responses of each resource are found in its specific documentation.

Requirements

Before connecting your application, you need:

  • An API key enabled for the integration.
  • A Learn administrator associated with that key, with access to the school and necessary operations.
  • The Learn URL corresponding to your integration.

If you are going to use a PADMA key, ask who manages the school to follow the guide How to generate and manage your school's API keys. The key must have an associated user corresponding to a Learn administrator. Coordinate its configuration with whoever manages the integration.

Send the key

Add .json to the resource path and send the key in the header X-API-KEY.

Example query to the list of schools:

curl --include \
  'https://learn.derose.app/admin/accounts.json' \
  --header 'Accept: application/json' \
  --header 'X-API-KEY: API_KEY_DE_EJEMPLO'

API_KEY_DE_EJEMPLO is a fictitious value. Replace it with your key and use the host corresponding to your integration.

Access to the list depends on the administrator's permissions. Correct authentication does not guarantee access to all schools.

Alternative: api_key

You can also send the key as a parameter api_key:

curl --include \
  'https://learn.derose.app/admin/accounts.json?api_key=API_KEY_DE_EJEMPLO'

Prefer the header to avoid including the key in URLs, histories, or intermediary logs.

If you send both values, a api_key non-empty parameter takes precedence over X-API-KEY. Send only one key per request.

How the administrator is identified

Learn tries to recognize the key in this order:

  1. It looks for a key belonging to a Learn administrator.
  2. If no match is found, it consults PADMA key validation.
  3. If PADMA returns a username, it looks for the Learn administrator linked to that user.

A valid PADMA key requires a corresponding administrator in Learn. Authentication does not automatically create that administrator.

The key identifies the administrator; their permissions determine which schools, resources, and operations the integration can use. The key does not grant additional permissions.

Format, session, and write requests

Use resource paths under /admin with the extension .json. For example, /admin/accounts.json.

The header Accept: application/json alone does not activate this key authentication mechanism. Include .json in the path.

Send the key in every request. Learn starts the administrator session to process it and closes that session upon normal processing completion. Your integration does not need to perform a prior browser login.

These JSON requests do not require a CSRF token from the web form. To send a JSON body, add Content-Type: application/json and use the method and parameters supported by the resource.

The extension .json activates this access mechanism but does not define a uniform contract for all resources. Check the endpoint documentation for its operations and response.

This access corresponds to the Escuelas API. The Alumnos API uses OAuth authorization and has a different mechanism.

Troubleshoot access problems

Situation What to check
The request does not authenticate Check the key, host, path under /admin and the extension .json.
The PADMA key is valid, but Learn does not recognize the administrator Verify that a Learn administrator linked to the username returned by PADMA exists.
The administrator cannot query or modify a resource Review their permissions and access to the corresponding school.
You receive a redirect or an HTML response Inspect the HTTP status and the header Location before following redirects. Check the format and administrator access requirements.
You receive 503 Service Unavailable when validating a PADMA key This can happen when the PADMA validation service returns a gateway error. Try again later.

A missing or unrecognized key does not start a session by API key. The request continues through normal access controls. Do not rely on a single code or JSON body for all authentication errors.

Store the key on your integration server. Avoid including it in public code, applications distributed to users, or shared screenshots.

Back to Schools API

Contact support