Create Session

View as Markdown
Initialize a Spain Public Administration flow session to access government portals and retrieve public records. This endpoint starts the flow lifecycle. Upon successful creation, it returns a `session_id` and a `widget_url`. Your frontend application must redirect the customer to the `widget_url` so they can log in and sign the consent form. Once the customer completes the widget journey, a webhook notification is delivered (if configured), and the decrypted results can be downloaded using the [Get Session Results](api:GET/es-public-administration/v1/manager/{session_id}/results) endpoint. > This endpoint needs to be executed with an app secret, so should always be used in server side without exposing the secret to customers.

Authentication

X-APP-SECRETstring
Application Secret

Request

This endpoint expects an object.
customer_idstringRequired1-64 characters
The external identifier of the customer in your system. Used for auditing and tracking.
settingsobjectRequired
Custom session settings containing requested features, redirection URLs, and webhook extra parameters.
date_limitstringOptionalformat: "datetime"
Custom expiration deadline for this session. After this timestamp, the widget cannot be opened.
fixed_parametersobjectOptional

Restricted credentials/parameters to enforce during user login in the widget.

Response

200 OK
Flow Session created successfully

session_idstringformat: "ObjectId"
The unique database identifier of the created flow session.
widget_urlstring
The secure redirection URL where the customer should be sent to open the widget.
session_tokenstring
Temporary security token scoped for the widget to interact with backend services during the session.

Errors

409
Conflict Error
422
Unprocessable Entity Error