🎉 Unlimited Free KYC - Forever!!

Auth + Data
Data API Reference
Retrieve Session

Retrieving Session User Data

To retrieve the user data shared in a data transfer session, you can call the /session/{session_id}/decision/ endpoint.

  • Base URL: https://apx.didit.me
  • Endpoint: /auth/v2/session/{session_id}/decision/
  • Method: GET
  • Authentication: Client Token (Bearer Token)

Request

To retrieve the session user data programmatically, follow these steps:

Authenticate

To obtain the access_token, refer to the Authentication documentation page.

ℹī¸

The access_token is valid for a limited time, so you do not need to authenticate for every request until the token expires.

Select Desired Parameters

  • session_id: Unique identifier for the session.

Retrieve Session User Data

Use the following request format to retrieve the session user data:

GET /auth/v2/session/{session_id}/decision/ HTTP/1.1
Host: apx.didit.me
Content-Type: application/json
Authorization: Bearer {access_token}

Response

Returns detailed information about the data transfer session, including the session status and the user data shared.

Example Response

{
  "session_id": "unique-session-identifier",
  "session_number": 12345,
  "status": "Confirmed",
  "vendor_data": "optional-vendor-data",
  "scope": "pictures names email",
  "user_data": {
    "sub": "user-unique-identifier",
    "email": {
      "email": "alejandro.rosas@example.com",
      "is_verified": true,
      "is_primary": true
    },
    "phone": {
      "phone_number": "+34123456789",
      "is_verified": true,
      "is_primary": true
    },
    "picture": "https://example.com/picture.png",
    "names": {
      "first_name": "John",
      "family_name": "Doe",
      "full_name": "John Doe",
      "is_verified": true
    },
  },
  "created_at": "2024-08-01T10:30:00.000Z"
}

Field Descriptions

  • session_id: Unique identifier for the session.
  • session_number: Numeric identifier for the session.
  • status: The current status of the data transfer session (e.g., Confirmed, Cancelled).
  • vendor_data: Vendor-specific data or unique identifier provided when creating the session.
  • scope: The data scopes that were requested and approved for sharing.
  • user_data: Contains the actual user data that was shared, structured according to the approved scopes. sub is the unique identifier for the user and it is always present so you can identify the user across different sessions.
  • created_at: Timestamp of when the data transfer session was created.

Code Example

const getSessionDecision = async (sessionId) => {
  const endpoint = `${BASE_URL}/auth/v2/session/${sessionId}/decision/`;
  const token = await getClientToken();
 
  if (!token) {
    console.error('Error fetching client token');
  } else {
    const headers = {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${token.access_token}`,
    };
 
    try {
      const response = await fetch(endpoint, {
        method: 'GET',
        headers,
      });
 
      const data = await response.json();
 
      if (response.ok) {
        return data;
      } else {
        console.error('Error fetching session decision:', data.message);
        throw new Error(data.message);
      }
    } catch (err) {
      console.error('Network error:', err);
      throw err;
    }
  }
};