> ## Documentation Index
> Fetch the complete documentation index at: https://docs.recurso.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# List Sessions

> List the logged-in user's unexpired dashboard sessions, flagging the current one.

Lists every unexpired dashboard session belonging to the logged-in user, with
`current: true` on the session that made the request. Use it to power a
"where you're signed in" view, then revoke a single session with
[Revoke Session](/api-reference/auth/revoke-session) or everything except the
current one with [Revoke Other Sessions](/api-reference/auth/revoke-other-sessions).

Requires a logged-in user session (the `recurso_session` cookie set by
[`/auth/login`](/api-reference/auth/login)). API-key callers have no user
identity and receive `401`.

## Example Request

```bash theme={null}
curl https://api.recurso.dev/v1/auth/sessions \
  -b cookies.txt
```

## Example Response

```json theme={null}
{
  "data": [
    {
      "id": "a1f4c9d2-7b3e-4e58-9c6a-2d8f0b1e5a73",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5) AppleWebKit/537.36 Chrome/126.0 Safari/537.36",
      "created_at": "2026-09-01T08:15:22Z",
      "expires_at": "2026-09-08T08:15:22Z",
      "current": true
    },
    {
      "id": "5c0e2b17-93da-4f61-b8a4-7e1f6d3c9b20",
      "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) Safari/604.1",
      "created_at": "2026-08-28T19:42:07Z",
      "expires_at": "2026-09-04T19:42:07Z",
      "current": false
    }
  ]
}
```

## Fields

| Field        | Type               | Description                                                                          |
| ------------ | ------------------ | ------------------------------------------------------------------------------------ |
| `id`         | string (uuid)      | Session identifier. Pass it to [Revoke Session](/api-reference/auth/revoke-session). |
| `user_agent` | string             | The `User-Agent` header recorded when the session was created.                       |
| `created_at` | string (date-time) | When the session was created.                                                        |
| `expires_at` | string (date-time) | When the session expires; expired sessions are not listed.                           |
| `current`    | boolean            | `true` for the session that made this request.                                       |

## Errors

| Status | Code             | When                                                                                            | Fix                                                                                           |
| ------ | ---------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| 401    | `unauthorized`   | No live session cookie, or the caller authenticated with an API key rather than a user session. | Sign in via [`/auth/login`](/api-reference/auth/login) and send the `recurso_session` cookie. |
| 500    | `internal_error` | The sessions could not be loaded.                                                               | Retry; contact support if it persists.                                                        |

Errors use the standard envelope — see [Errors](/api-reference/errors).


## OpenAPI

````yaml GET /v1/auth/sessions
openapi: 3.1.0
info:
  title: Recurso API
  version: 1.0.0
  description: |
    The Recurso billing engine REST API.

    Authenticate by passing your API key as a bearer token:

        Authorization: Bearer <api_key>

    Obtain an API key by registering a tenant via `POST /auth/register`.
    All authenticated endpoints live under the `/v1` prefix. Mutating
    endpoints support idempotency via the `Idempotency-Key` header.
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://billing.example.com
    description: >-
      Example deployment — substitute the base URL of your own Recurso
      deployment.
security:
  - bearerAuth: []
tags:
  - name: System
    description: Health, version, and API metadata
  - name: Auth
    description: Tenant registration
  - name: Plans
    description: Product catalog plans
  - name: Customers
    description: Customer management
  - name: Subscriptions
    description: Subscription lifecycle
  - name: Invoices
    description: Invoices, PDFs, and Indian GST e-invoicing
  - name: Coupons
    description: Discounts
  - name: Usage
    description: Metered usage events
  - name: Credit Notes
    description: Customer credits
  - name: Quotes
    description: Quote-to-invoice lifecycle
  - name: Webhooks
    description: Webhook endpoint management and event feed
  - name: Analytics
    description: Revenue analytics
  - name: Checkout
    description: Public hosted checkout for invoices
  - name: Payments
    description: Payment order creation
  - name: Inbound Webhooks
    description: Receivers for payment-gateway callbacks (Razorpay, Stripe)
  - name: Customer Portal
    description: Customer-facing portal — magic-link auth and session-scoped data
  - name: Developer
    description: API key management
  - name: Account
    description: Tenant account settings
  - name: Finance
    description: Ledger accounts, entries, reconciliation, and revenue recognition
  - name: Settings
    description: Tax (GST) and e-invoicing (IRP) configuration
  - name: Consents
    description: Consent records for RBI-compliant recurring billing
  - name: Referrals
    description: Customer referral program
  - name: Gifts
    description: Gift subscriptions
  - name: Mandates
    description: UPI Autopay mandates
  - name: Offline Payments
    description: Virtual accounts and manually recorded payments
  - name: Organizations
    description: Multi-entity organizations grouping several tenants
  - name: Accounting
    description: QuickBooks / Xero accounting integrations
  - name: Churn
    description: Churn risk scoring and alerts
  - name: Cancel Flows
    description: Configurable retention flows shown at cancellation time
  - name: Dunning
    description: Dunning analytics and multi-channel dunning campaigns
paths:
  /v1/auth/sessions:
    get:
      tags:
        - Auth
      summary: List active sessions
      description: >
        Lists the logged-in user's unexpired sessions, flagging the request's
        own session with `current: true`. Requires a logged-in user session.
      operationId: listSessions
      responses:
        '200':
          description: The user's active sessions.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        user_agent:
                          type: string
                        created_at:
                          type: string
                          format: date-time
                        expires_at:
                          type: string
                          format: date-time
                        current:
                          type: boolean
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - sessionCookie: []
components:
  responses:
    Unauthorized:
      description: Missing or invalid credentials (API key or session cookie).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          description: Structured error detail.
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
              examples:
                - validation_failed
                - unauthorized
                - forbidden
                - not_found
                - conflict
                - rate_limited
                - internal_error
                - invalid_api_key
                - key_mode_mismatch
                - over_refund
                - invoice_not_paid
                - invoice_already_paid
            message:
              type: string
              description: Human-readable explanation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: >-
        Tenant API key obtained from `POST /auth/register` or `POST
        /v1/developer/keys`.
    sessionCookie:
      type: apiKey
      in: cookie
      name: recurso_session
      description: >
        Dashboard user session cookie (httpOnly) issued by `POST /auth/register`
        and `POST /auth/login`. v1 endpoints accept EITHER this cookie or the
        tenant API key (`bearerAuth`).

````