# SPID Services Flows

This document briefly describes the operation flows of the **SPID Services**, the API for integration with the *SPID Client*.

There are two essential flows, *On-site Capture* and *Remote Capture*, detailed below.

## On-site Capture

The operation flow for on-site capture follows the diagram below, and the main differentiation depends on whether the consulted CPF already exists in the database. All operations mentioned in this flow are detailed in the manual [SPID Services API](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5).

![SPID Services Flow: On-site Capture](/files/6cd1b5c2dd0b7d2d304877578608ab8381ddd139)

### Authentication

1. The application must authenticate with the SPID Client using the call [Login](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#login) and make sure the operation was successful with the call [Login Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#login-status).
2. The application must start a verification by calling [Verify](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#verify) with the individual's CPF.

If the individual's CPF is not in the database, the call will return *PERSON\_NOT\_FOUND*, and the application must follow [Unregistered Individual](#individuo-nao-cadastrado). Otherwise, it must follow the [Already Registered Individual](#individuo-ja-cadastrado).

### Unregistered Individual

1. The application needs to perform the *enroll* of the individual by calling [Enroll](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#enroll) (Enroll) and call [Capture Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-status) until it obtains the status *CLIENT\_CAPTURE\_DONE*.
2. The application must start the biometric authentication of the operator with [Operator Capture](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#operator-capture), and call [Capture Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-status) until it obtains the indication of success *OPERATOR\_CAPTURE\_DONE*.
3. The application must send the capture with [Capture Send](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-send) (*Send*). In this case, the operation will be asynchronous, the expected response is *CAPTURE\_ENQUEUED*.
4. Optionally, the application can query the processing status of the enroll with [Capture Result by ID](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-result-by-id). Enroll processing can be time-consuming, and the application should not assume it will receive a definitive response within a short waiting period.
5. The application can obtain the operation report with [Capture Report](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-report), completing the individual's processing flow.

### Already Registered Individual

1. The call **Verify** will return *CLIENT\_CAPTURING* and the individual's biometric capture will be started. The application must call [Capture Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-status) until it gets an indication that the capture has been completed, *CLIENT\_CAPTURE\_DONE*.
2. The application must start the biometric authentication of the operator with [Operator Capture](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#operator-capture), and call [Capture Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-status) until it obtains the indication of success *OPERATOR\_CAPTURE\_DONE*.
3. The application must send the capture with [Capture Send](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-send) (*Send*). In this case, the operation will be synchronous and will return the response *VERIFIED* indicating success.
4. The application must obtain the biometric match status by calling [Capture Result by ID](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-result-by-id) with the *TGUID* received in the previous step. If there was no match (*SEARCH\_NOT\_MATCH*), the application may, if desired, perform the individual's enroll.
5. The application can obtain the operation report with [Capture Report](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-report), completing the individual's processing flow.

### Resubmissions

Submissions (**Capture Send**) can fail due to transmission errors and temporary infrastructure failures (servers unavailable or overloaded). It is recommended that the application perform a daily retry of pending operations by calling [Capture Resend All](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-resend-all) (*Capture Resend All*).

## Remote Capture

The operation flow for remote capture through an external verification service, which includes an application installed on the client device (smartphone/tablet), follows the diagram below. All operations mentioned in this flow are detailed in the manual [SPID Services API](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5). Remote capture allows both verification of clients already registered in the database (Remote Verify) and registration of new clients (Remote Enroll).

![SPID Services Flow: Remote Capture](/files/f103c0dbd2c1699bd8578c3fbe5d53a9e1892b84)

### Authentication

1. The application must authenticate with the SPID Client using the call [Login](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#login) and make sure the operation was successful with the call [Login Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#login-status).

### Operator Capture

1. The application must start the biometric authentication of the operator with [Operator Capture](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#operator-capture), and call [Capture Status](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#capture-status) until it obtains the indication of success *OPERATOR\_CAPTURE\_DONE*.

### Remote Client Verification

1. The application must start the client's remote verification with the call [Remote Verify](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#remote-verify). This call will return a *URL* (used by the client's external application to submit the biometric data for verification) and an *TGUID* (transaction identifier).
2. The *URL* is passed to the remote verification service, which will perform the biometric capture (through an application on the client's device) and will use the URL to submit the captured biometric data.
3. The application must check the result of the biometric verification with the call [Remote Verify Result by ID](broken://spaces/MqtschPie46KAAzuKKeD/pages/suQa3nM3QfSgXnSaUff5#remote-verify-result-by-id), which will return *SEARCH\_MATCH* or *SEARCH\_NOT\_MATCH*, indicating the result of the operation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.griaule.com/psbio/en/spid/fluxo_spid_services.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
