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

# Get Checkout Session

> Retrieve checkout session status and details

<Endpoint method="GET" path="/api/v1/sessions/:sessionId" />

Retrieve the current status and details of a checkout session. Use this endpoint to verify whether a session was completed after the user is redirected back to your application. Only sessions belonging to your developer account can be accessed.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://dhmad.tn/api/v1/sessions/550e8400-e29b-41d4-a716-446655440000 \
    -H "Authorization: Bearer sk_live_your_api_key_here"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://dhmad.tn/api/v1/sessions/550e8400-e29b-41d4-a716-446655440000', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer sk_live_your_api_key_here'
    }
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://dhmad.tn/api/v1/sessions/550e8400-e29b-41d4-a716-446655440000',
      headers={'Authorization': 'Bearer sk_live_your_api_key_here'}
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "session": {
      "sessionId": "550e8400-e29b-41d4-a716-446655440000",
      "escrowId": "507f1f77bcf86cd799439011",
      "action": "sign_contract",
      "targetUserEmail": "buyer@example.com",
      "status": "completed",
      "metadata": {
        "order_id": "ord_123"
      },
      "expiresAt": "2024-01-15T10:30:00Z",
      "completedAt": "2024-01-15T10:15:00Z",
      "createdAt": "2024-01-15T10:00:00Z"
    }
  }
  ```
</ResponseExample>

## Path Parameters

<ParamField path="sessionId" type="string" required>
  Session ID returned from the create checkout session endpoint
</ParamField>

## Response Fields

<ParamField response="session.sessionId" type="string">
  Unique session identifier
</ParamField>

<ParamField response="session.escrowId" type="string">
  Escrow ID this session belongs to
</ParamField>

<ParamField response="session.action" type="string">
  The action type: `sign_contract`, `accept_pay`, `complete`, `dispute`, `request_cancellation`, `reject_cancellation`, `accept_cancellation`, `cancel_escrow`, `submit_proof`, or `review_proof`
</ParamField>

<ParamField response="session.targetUserEmail" type="string">
  Email of the user who was intended to perform the action
</ParamField>

<ParamField response="session.status" type="string">
  Current status: `pending`, `completed`, `expired`, or `cancelled`
</ParamField>

<ParamField response="session.metadata" type="object">
  Metadata key-value pairs passed when creating the session, if any
</ParamField>

<ParamField response="session.expiresAt" type="string">
  ISO 8601 timestamp when the session expires or expired
</ParamField>

<ParamField response="session.completedAt" type="string|null">
  ISO 8601 timestamp when the session was completed, or null if not yet completed
</ParamField>

<ParamField response="session.createdAt" type="string">
  ISO 8601 timestamp when the session was created
</ParamField>

## Error Responses

### 401 Unauthorized

```json theme={null}
{
  "error": "Unauthorized"
}
```

### 403 Forbidden

```json theme={null}
{
  "error": "Forbidden",
  "message": "You do not have access to this checkout session."
}
```

### 404 Not Found

```json theme={null}
{
  "error": "Checkout session not found"
}
```

***

<Info>
  Use this endpoint to verify session status after the user is redirected back to your application. If the redirect includes `status=completed`, you can call this endpoint to confirm and retrieve full session details. Treat webhooks as the source of truth for escrow state; this endpoint is for session-level verification.
</Info>
