Skip to main content
curl https://production.methodfi.com/opal/token \
  -X POST \
  -H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "card_connect",
    "session_id": "osess_zde3mW34pEHqV",
    "entity_id": "ent_fc92i43kc34",
    "card_connect": {
      "selection_type": "single"
    }
  }'
{
  "success": true,
  "data": {
    "token": "otkn_THpBacqVBBrDkfqUf9htjm4QWAEJLY9a",
    "valid_until": "2025-05-08T22:21:40.312Z",
    "session_id": "osess_zde3mW34pEHqV" // Save this session_id to resume later
  },
  "message": null
}
Opal Sessions are long-lived stateful connections between your app and Opal. They allow you to store user data, resume user sessions, and retrieve data later. Sessions are created when you create an Opal Token, and when passed into Opal, they are automatically resumed.

Creating a new session

First, create a new Opal Token with your desired configuration. This will create a new session.
curl https://production.methodfi.com/opal/token \
  -X POST \
  -H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "card_connect",
    "session_id": "osess_zde3mW34pEHqV",
    "entity_id": "ent_fc92i43kc34",
    "card_connect": {
      "selection_type": "single"
    }
  }'
{
  "success": true,
  "data": {
    "token": "otkn_THpBacqVBBrDkfqUf9htjm4QWAEJLY9a",
    "valid_until": "2025-05-08T22:21:40.312Z",
    "session_id": "osess_zde3mW34pEHqV" // Save this session_id to resume later
  },
  "message": null
}

Resuming an existing session

To resume an existing session, create a new token by passing the session_id from a previous session
curl https://production.methodfi.com/opal/token \
  -X POST \
  -H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "osess_zde3mW34pEHqV"    // Pass the session_id to resume
  }'
{
  "success": true,
  "data": {
    "token": "otkn_THpBacqVBBrDkfqUf9htjm4QWAEJLY9a",
    "valid_until": "2025-05-08T22:21:40.312Z",
    "session_id": "osess_zde3mW34pEHqV"
  },
  "message": null
}
I