---
title: "Create Widget Session"
method: POST
path: "/api/v1/widgets/session"
tags: ["Widgets"]
---

# Create Widget Session

`POST /api/v1/widgets/session`

## Request

- Base URL: `https://merchant-api.accruesavings.com`
- URL: `https://merchant-api.accruesavings.com/api/v1/widgets/session`
- Auth: none declared. Required headers: `Client-ID`, `Authorization`
- TypeScript: <https://skmtc.dev/byaccrue/apis/accrue-merchant-api/docs/api/v1/widgets/session/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new widget session that can be used to authenticate and interact with Accrue widgets. The session token returned should be passed to the widget for authentication.

## Headers

- `Client-ID` string, uuid, required: The unique identifier of the client making the request. This header is required to retrieve the client-specific configuration and ensure that the response is tailored to the client's settings and permissions.
- `Authorization` string, uuid, required: Secure secret to access privileged endpoints.

## Request body

- CreateWidgetSessionRequest
  - `data` object, required
    - `type` 'CreateWidgetSession', required
    - `attributes` object, required
      - `widgetType` 'PaymentMethods', required: The type of widget for which to create a session

## Response `200`

Widget session created successfully

- CreateWidgetSessionResponse
  - `data` WidgetSession, required: Widget Session
    - `id` string, uuid, required: Unique identifier for the object.
    - `type` 'WidgetSession', required
    - `attributes` object, required
      - `sessionToken` string, required: The session token used to authenticate widget requests
      - `createdAt` string, date-time, required: The timestamp when the session was created

## Other responses

- `400`: Bad Request

---

[API](https://skmtc.dev/byaccrue/apis/accrue-merchant-api.md) - [All operations](https://skmtc.dev/byaccrue/apis/accrue-merchant-api/llms.txt) - [OpenAPI document](https://skmtc.dev/byaccrue/apis/accrue-merchant-api/revisions/3e2d97ef2e6e?raw)
