Base URL: /v1/virtual-cards
Authentication
All endpoints are secured with Onion’s API-Key header (x-api-key).
Endpoints
1. Get or Create Card
Retrieve a user’s virtual card. If the user does not yet have a card one will be created automatically.GET /v1/virtual-cards/:userId
Path parameters
| name | type | description |
|---|---|---|
| userId | string | Onion user id |
Response 200 OK
Errors
| code | example payload |
|---|---|
| 400 | { "error": "clientId missing" } |
2. Explicitly Create Card
If you prefer to create the card explicitly use:POST /v1/virtual-cards
Body
Returns the same payload as Get or Create above. If a card already exists the existing resource is returned.
3. List Card Transactions
Fetch a paginated list of transactions performed with the virtual card.GET /v1/virtual-cards/transactions/:userId/:page
Path parameters
| name | type | description |
|---|---|---|
| userId | string | Onion user id |
| page | int | Page number (starting at 1) |
Response 200 OK
Errors
| code | payload |
|---|---|
| 404 | { "error": "virtual card not found" } |

