OpheliaDocs
Search docs⌘K
DashboardCreate an account
v3 · Guide

Use a person's own account

Connect a person's own account on a site once, with their phone or email and the code the site sends. Their later bookings there can then sign in as them and pay with the card the account holds.

What it does

The API calls a connected account a session: its routes are under /v3/sessions and its id starts vss_. This page says "connected account".

Ophelia opens the site's sign-in, enters the person's phone or email, and the site sends them a code. You send that code. Ophelia keeps the signed-in account under your end_user id for that site.

Passwords
Never. Ophelia signs in with a code only.
New accounts
Never. The person must already have an account on the site.
One site, one account
A connected account on a site is also found on that site's subdomains. Its site is the host: connecting on opheliapractice.com/shop gives opheliapractice.com.
How long it lasts
expires_at is when the site's own sign-in runs out, as its sign-in cookie says (the practice site gives 30 days). created_at and connected_at say when it was first connected; on a connected account they are equal. After expires_at, or once the site stops accepting it, the connected account reads failed with reconnect_required.

Connect an account

FieldWhat it says
site
The site, or send its address as url
end_user
Required. Your own stable id for the person.
profile.phone or profile.email
What the person signs in with. A phone is E.164 (+15551234567) or a 10-digit US number.
profile.given_name
Optional. The person’s first name.
curl
curl -X POST https://api.opheliaos.com/v3/sessions \
-H "Authorization: Bearer YOUR_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"site": "opheliapractice.com/shop",
"end_user": "u_jane_1",
"profile": { "email": "jane.smith.diner@gmail.com" }
}'

The answer is 201 once the site has answered: here it sent the code. next_action says a code is due and when the chance to send it ends, about 10 minutes later. A connect that ends failed at once is 201 too, with the object and its error_code. Continue, GET and DELETE answer 200.

json
{
"object": "v3.session",
"id": "vss_f1fc8f70c5abb973eeeea519",
"site": "opheliapractice.com",
"end_user": "u_jane_1",
"status": "requires_action",
"next_action": {
"type": "otp",
"expires_at": "2026-11-03T20:20:52.023934-05:00"
},
"error_code": null,
"error": null,
"created_at": "2026-11-04T01:10:52.023872Z",
"connected_at": null,
"expires_at": null
}

If the site takes longer to answer, you get 202 with status: "connecting". Read GET /v3/sessions/{session_id} until it changes.

Send the code

Ask the person for the code the site sent them, and send it as code (otp_code also works).

curl
curl -X POST https://api.opheliaos.com/v3/sessions/vss_f1fc8f70c5abb973eeeea519/continue \
-H "Authorization: Bearer YOUR_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{ "code": "246810" }'
json
{
"object": "v3.session",
"id": "vss_f1fc8f70c5abb973eeeea519",
"site": "opheliapractice.com",
"end_user": "u_jane_1",
"status": "active",
"next_action": null,
"error_code": null,
"error": null,
"account": { "name": "Guest" },
"created_at": "2026-11-04T01:10:52.024898Z",
"connected_at": "2026-11-04T01:10:52.024898Z",
"expires_at": "2026-12-04T01:10:52Z"
}

account.name is the name the site greets the person by. A wrong code ends the connect with 200 and status: "failed". It is not asked for again, unlike a code in a booking:

json
{
"object": "v3.session",
"id": "vss_02277e022d59980d465e1d7d",
"site": "opheliapractice.com",
"end_user": "u_jane_2",
"status": "failed",
"next_action": null,
"error_code": "otp_invalid",
"error": "the site did not accept that code: it asked for a code again"
}

To try again, connect again with POST /v3/sessions and the site sends a new code. A connect sent within 30 seconds of a code answers with the connected account already waiting for that code, so the person is not sent a second one.

Statuses

statusMeans
connecting
Ophelia is still on the site. Read it again.
requires_action
The site sent a code. Send it before next_action.expires_at.
active
Connected. Bookings can use it.
failed
Not connected. error_code says why.
disconnected
You disconnected it. The saved sign-in is deleted.

List and read

List a person's connected accounts with GET /v3/sessions. Filter with end_user and site. Read one with GET /v3/sessions/{session_id}; it answers the same object as above.

curl
curl "https://api.opheliaos.com/v3/sessions?end_user=u_jane_1" \
-H "Authorization: Bearer YOUR_TEST_KEY"
json
{
"data": [
{
"object": "v3.session",
"id": "vss_f1fc8f70c5abb973eeeea519",
"site": "opheliapractice.com",
"end_user": "u_jane_1",
"status": "active",
"next_action": null,
"account": { "name": "Guest" },
"connected_at": "2026-11-04T01:10:52.024898Z",
"expires_at": "2026-12-04T01:10:52Z"
}
],
"object": "list"
}

Use it in a booking

On POST /v3/bookings for the same site, send the same end_user with authorize.sign_in: true and authorize.fill_identity: true. Ophelia signs in as the person before it books. To pay with the account's saved card, add authorize.payment: "account_on_file" with a ceiling; the full rules and an example are on Pay.

curl
curl -X POST https://api.opheliaos.com/v3/bookings \
-H "Authorization: Bearer YOUR_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"entity_id": "ent_ec79fac5b91a04424a47487c",
"idempotency_key": "docs-aof-001",
"end_user": "u_jane_1",
"customer": {
"name": "Jane Smith",
"email": "jane.smith.diner@gmail.com",
"phone": "+12124567890",
"address": { "street": "350 5th Ave", "line2": "Suite 4100", "city": "New York", "state": "NY", "zip_code": "10118", "country": "US" }
},
"authorize": {
"sign_in": true,
"fill_identity": true,
"payment": "account_on_file",
"max_total": 100,
"currency": "USD"
}
}'

The answer is the booking (here, succeeded with order PX-509759). The booking keeps the connected account's sign-in up to date. If the site asked to sign in anyway, or answered account_required or password_required, the connected account then reads failed with reconnect_required: connect it again.

A booking on the account is real. At commitit places the order or the reservation in the person's own name, on their own card, and v3 cannot undo it.

Disconnect

DELETE /v3/sessions/{session_id} deletes the saved sign-in. Do it when the person asks you to forget the account.

curl
curl -X DELETE https://api.opheliaos.com/v3/sessions/vss_f1fc8f70c5abb973eeeea519 \
-H "Authorization: Bearer YOUR_TEST_KEY"
json
{
"object": "v3.session",
"id": "vss_f1fc8f70c5abb973eeeea519",
"site": "opheliapractice.com",
"end_user": "u_jane_1",
"status": "disconnected",
"next_action": null,
"error_code": null,
"error": null,
"connected_at": null,
"expires_at": null
}

What can go wrong

A refused request answers {"error_code", "error"}:

json
{
"error": "phone must be E.164 (+15551234567) or a 10-digit US number",
"error_code": "phone_invalid"
}
AnswerWhat it means and what to do
400 end_user_required
Send end_user.
400 phone_or_email_required
Send profile.phone or profile.email.
400 phone_invalid
Send the phone as E.164 or a 10-digit US number.
400 no_site, unresolvable_site, private_address
Name a public website in site.
400 code_required
The continue had no code. (A booking's continue with no code answers 400 invalid_input instead.)
403 merchant_not_enabled_for_key
The site is not switched on for this key (the body lists allowed_sites). Turn it on for the key in the dashboard, or use a key that has it.
404 session_not_found
No connected account with that id.
409 not_awaiting_code
This connected account is not waiting for a code. Read it to see its status.
409 continue_in_flight
A code for it is already being entered. Do not send it again; read it. (On a booking the same code comes as 200 processing.)
503 sessions_unavailable
Connected accounts are not enabled on this deployment.
503 with Retry-After: 60
Ophelia is busy (drive_capacity, no_clean_exit). Wait the seconds given and connect again.

A connect that ends failed says why in error_code:

error_codeWhat it means and what to do
otp_invalid
The site did not take the code. Connect again for a new code.
otp_not_sent
The site sent no code. Connect again later.
password_required
The site asks for a password. Ophelia never uses passwords, so this account cannot be connected.
account_required
The site needs a signed-in account and Ophelia could not sign in, or the site offers only to create one. Ophelia never creates an account.
attempt_expired
The code came after next_action.expires_at, or the sign-in did not finish. Connect again.
reconnect_required
It was connected, and the site no longer accepts the sign-in. Connect again.
A site wall
The site refused automated access. error_code names the wall. Try later.

POST /v3/sessions shares one budget with POST /v3/bookings: 10 every 5 minutes for your organization. The two continue routes share 20. See Rate limits.

In a booking, authorize.sign_in without authorize.fill_identity or end_user is 400, naming the missing field.

Next: Know what an answer means.