> This page is for Spain Public Administration Flow.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://infonite.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://infonite.dev/_mcp/server.

# Get Session State

GET https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/{session_id}

Retrieve the current execution state, lifecycle status, and active cursor screen of the flow session.

This endpoint allows synchronous checking of a session's progress. While [webhooks](/guides/webhooks) are the recommended asynchronous way to track status updates — they are configured once per application in the Console, not per session — this endpoint is useful for clients that want to keep their backend state synchronized with INFONITE.

Common use cases include:

* Polling for session completion or terminal failure status when webhooks are not implemented.
* Retrieving the active cursor/screen to display progress or updates in client dashboards.
* Recovering and synchronizing the final session state if a connection is lost during the flow.

If polling, poll this endpoint for **`is_closed`**, not for anything else. While it is `false` the session is still alive — even if the customer left, even if the widget closed, even if you already received partial results. A source may still be working in the background (the *CIRBE* report from the Banco de España is the usual case), and records can still change or appear.

`status_code` alone is not the answer: a session sitting on `WAITING` with the cursor at `es-public-administration:connect:wait` is unfinished by design, not stuck.

Once the session is closed, `status_code` says who ended it — your customer, you, or the platform — and why: [How a session ends](/flows/spain-public-administration/overview#how-a-session-ends).

> This endpoint needs to be executed with an app secret, so should always be used in server side without exposing the secret to customers.

Reference: https://infonite.dev/flows/spain-public-administration/api-reference/spain-public-administration-api/sessions-management/flows-es-public-administration-v-1-session-state

## Authentication

- `X-APP-SECRET` header (required) — Application Secret

## Servers

- `https://widgets.infonite.tech/api/flows` (Legacy, default)
- `https://widgets.infonite.io/api/flows` (Production)

## Request

### Path parameters

- `session_id` (string, required) — Session ID to fetch

## Response

### 200

**200 OK**The session is FINISHED and nothing about it will change.

- `kind` ("es-public-administration", required) — The flow type identifier, always 'es-public-administration'.
- `cursor` (enum, required) — The current screen identifier where the user is positioned in the widget experience.
  - Allowed values: `es-public-administration:welcome:init`, `es-public-administration:welcome:consent`, `es-public-administration:connect:source`, `es-public-administration:connect:wait`, `es-public-administration:bye:completed`, `es-public-administration:bye:failure`
- `session_id` (string, required) — The unique database identifier of this flow session.
- `app_id` (string, required) — The identifier of the client application that owns this session.
- `customer_id` (string, required) — The external customer reference provided by the client application.
- `status_code` (enum, required) — The status of the session: `READY` while the person is in the widget, `WAITING` once they have left and a read still runs in the background (the Banco de España's report is the usual one). Any other status is final.
  - Allowed values: `READY`, `WAITING`, `COMPLETED`, `FAILED`, `SYSTEM_CANCELLED`, `CLIENT_CANCELLED`, `CUSTOMER_CANCELLED`, `TIMED_OUT`, `CONFIGURATION_ERROR`
- `date_created` (string, required) — The timestamp when this flow session was created.
- `date_limit` (string, required) — The deadline by which the session must be completed by the user. Always present — 12 hours after creation when you did not ask for another.
- `expiration_date` (string, required) — The timestamp when this session record will be auto-deleted from the database.
- `is_closed` (boolean, required) — Indicates if the flow session has been finalized or closed.
- `status_message` (string, optional) — An informative status message describing the current session state.
- `date_started` (string, optional) — The timestamp when the customer opened the session widget.
- `ping_date` (string, optional) — The timestamp of the last customer interaction or heartbeat.
- `date_ended` (string, optional) — The timestamp when the flow session was finalized or closed.
- `end_hook` (enum, optional) — Delivery status of the final webhook event callback.
  - Allowed values: `skipped`, `pending`, `delivered`, `re_delivered`, `doubtful`, `failed`, `ko`

### 202

**202 Accepted**Still open — the same body, and there is more to come. Ask again, or wait for a webhook.

- `kind` ("es-public-administration", required) — The flow type identifier, always 'es-public-administration'.
- `cursor` (enum, required) — The current screen identifier where the user is positioned in the widget experience.
  - Allowed values: `es-public-administration:welcome:init`, `es-public-administration:welcome:consent`, `es-public-administration:connect:source`, `es-public-administration:connect:wait`, `es-public-administration:bye:completed`, `es-public-administration:bye:failure`
- `session_id` (string, required) — The unique database identifier of this flow session.
- `app_id` (string, required) — The identifier of the client application that owns this session.
- `customer_id` (string, required) — The external customer reference provided by the client application.
- `status_code` (enum, required) — The status of the session: `READY` while the person is in the widget, `WAITING` once they have left and a read still runs in the background (the Banco de España's report is the usual one). Any other status is final.
  - Allowed values: `READY`, `WAITING`, `COMPLETED`, `FAILED`, `SYSTEM_CANCELLED`, `CLIENT_CANCELLED`, `CUSTOMER_CANCELLED`, `TIMED_OUT`, `CONFIGURATION_ERROR`
- `date_created` (string, required) — The timestamp when this flow session was created.
- `date_limit` (string, required) — The deadline by which the session must be completed by the user. Always present — 12 hours after creation when you did not ask for another.
- `expiration_date` (string, required) — The timestamp when this session record will be auto-deleted from the database.
- `is_closed` (boolean, required) — Indicates if the flow session has been finalized or closed.
- `status_message` (string, optional) — An informative status message describing the current session state.
- `date_started` (string, optional) — The timestamp when the customer opened the session widget.
- `ping_date` (string, optional) — The timestamp of the last customer interaction or heartbeat.
- `date_ended` (string, optional) — The timestamp when the flow session was finalized or closed.
- `end_hook` (enum, optional) — Delivery status of the final webhook event callback.
  - Allowed values: `skipped`, `pending`, `delivered`, `re_delivered`, `doubtful`, `failed`, `ko`

## Errors

### 404 Not Found Error

**404 Not Found**Session not found

- `detail` (string, required) — Error message

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 429 Too Many Requests Error

**429 Too Many Requests**Too many requests. Rate limit exceeded.

- `detail` (string, required) — Error message

### 504 Gateway Timeout Error

**504 Gateway Timeout**Lock timeout, retry again

- `detail` (string, required) — Error message

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

### Finished, with everything delivered

**Response**

```json
{
  "kind": "es-public-administration",
  "cursor": "es-public-administration:bye:completed",
  "session_id": "644599da47847b79c03cc94f",
  "app_id": "644599da47847b79c03cc94a",
  "customer_id": "cust_esp_202406",
  "status_code": "COMPLETED",
  "date_created": "2026-09-12T10:15:02+00:00",
  "date_limit": "2026-09-12T23:59:59+00:00",
  "expiration_date": "2026-09-19T10:17:52+00:00",
  "is_closed": true,
  "date_started": "2026-09-12T10:15:44+00:00",
  "date_ended": "2026-09-12T10:17:52+00:00",
  "end_hook": "delivered"
}
```

**SDK Code**

```python Finished, with everything delivered
import requests

url = "https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f"

headers = {"X-APP-SECRET": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Finished, with everything delivered
const url = 'https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f';
const options = {method: 'GET', headers: {'X-APP-SECRET': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Finished, with everything delivered
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-APP-SECRET", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Finished, with everything delivered
require 'uri'
require 'net/http'

url = URI("https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-APP-SECRET"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Finished, with everything delivered
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f")
  .header("X-APP-SECRET", "<apiKey>")
  .asString();
```

```php Finished, with everything delivered
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f', [
  'headers' => [
    'X-APP-SECRET' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Finished, with everything delivered
using RestSharp;

var client = new RestClient("https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f");
var request = new RestRequest(Method.GET);
request.AddHeader("X-APP-SECRET", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Finished, with everything delivered
import Foundation

let headers = ["X-APP-SECRET": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Open, with the customer on screen

**Response**

```json
{
  "kind": "es-public-administration",
  "cursor": "es-public-administration:connect:source",
  "session_id": "644599da47847b79c03cc94f",
  "app_id": "644599da47847b79c03cc94a",
  "customer_id": "cust_esp_202406",
  "status_code": "READY",
  "date_created": "2026-09-12T10:15:02+00:00",
  "date_limit": "2026-09-12T23:59:59+00:00",
  "expiration_date": "2026-09-19T10:15:02+00:00",
  "is_closed": false,
  "date_started": "2026-09-12T10:15:44+00:00",
  "ping_date": "2026-09-12T10:17:39+00:00"
}
```

**SDK Code**

```python Open, with the customer on screen
import requests

url = "https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f"

headers = {"X-APP-SECRET": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Open, with the customer on screen
const url = 'https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f';
const options = {method: 'GET', headers: {'X-APP-SECRET': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Open, with the customer on screen
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-APP-SECRET", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Open, with the customer on screen
require 'uri'
require 'net/http'

url = URI("https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-APP-SECRET"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Open, with the customer on screen
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f")
  .header("X-APP-SECRET", "<apiKey>")
  .asString();
```

```php Open, with the customer on screen
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f', [
  'headers' => [
    'X-APP-SECRET' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Open, with the customer on screen
using RestSharp;

var client = new RestClient("https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f");
var request = new RestRequest(Method.GET);
request.AddHeader("X-APP-SECRET", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Open, with the customer on screen
import Foundation

let headers = ["X-APP-SECRET": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://widgets.infonite.tech/api/flows/es-public-administration/v1/manager/644599da47847b79c03cc94f")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```