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

# Sessions

> Create and manage event payment sessions.

## Create session

**POST** `/v1/sessions`

<ParamField header="x-api-key" type="string" required>
  Your organisation's API key.
</ParamField>

<ParamField body="external_event_id" type="string" required>
  Your platform's unique identifier for this event.
</ParamField>

<ParamField body="name" type="string" required>
  Human-readable event name. Used as the collection account name.
</ParamField>

<ParamField body="currency" type="string" default="NGN">
  Currency code. Currently only `NGN` is supported.
</ParamField>

<ParamField body="starts_at" type="string">
  ISO 8601 datetime for when the event starts.
</ParamField>

<ParamField body="ends_at" type="string">
  ISO 8601 datetime for when the event ends.
</ParamField>

<ParamField body="collection" type="object" required>
  <Expandable title="collection fields">
    <ParamField body="account" type="boolean" required>
      Whether to provision a dedicated collection account.
    </ParamField>

    <ParamField body="pos" type="boolean" required>
      Whether to assign POS terminals.
    </ParamField>

    <ParamField body="pos_count" type="number">
      Number of POS terminals to assign (1–50). Required if `pos` is `true`.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="webhook_url" type="string">
  URL Kler will `POST` transaction events to. See [Webhooks](/concepts/webhooks).
</ParamField>

<ParamField body="metadata" type="object">
  Arbitrary JSON to attach to the session.
</ParamField>

<RequestExample>
  ```bash theme={null}
  curl -X POST https://api.kler.africa/v1/sessions \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "external_event_id": "evt_abc123",
      "name": "Lagos Music Festival 2025",
      "collection": { "account": true, "pos": true, "pos_count": 2 },
      "webhook_url": "https://yourplatform.com/webhooks/kler"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "data": {
      "session_id": "3f1e2d...",
      "status": "active",
      "external_event_id": "evt_abc123",
      "name": "Lagos Music Festival 2025",
      "currency": "NGN",
      "collection_account": {
        "account_number": "1234567890",
        "account_name": "Kler / Lagos Music Festival 2025",
        "bank_name": "Providus Bank",
        "bank_code": "101"
      },
      "pos_terminals": [
        { "terminal_id": "pos_3f1e2d_001", "label": "Terminal 1", "status": "assigned" },
        { "terminal_id": "pos_3f1e2d_002", "label": "Terminal 2", "status": "assigned" }
      ],
      "created_at": "2025-08-01T10:00:00.000Z"
    }
  }
  ```
</ResponseExample>

***

## Get session

**GET** `/v1/sessions/:id`

<RequestExample>
  ```bash theme={null}
  curl https://api.kler.africa/v1/sessions/3f1e2d... \
    -H "x-api-key: YOUR_API_KEY"
  ```
</RequestExample>

***

## Close session

**PATCH** `/v1/sessions/:id/close`

Marks the session as `closed`. No further payments will be accepted.

<RequestExample>
  ```bash theme={null}
  curl -X PATCH https://api.kler.africa/v1/sessions/3f1e2d.../close \
    -H "x-api-key: YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "session_id": "3f1e2d...",
      "status": "closed"
    }
  }
  ```
</ResponseExample>
