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

# Create session

> Create a new session for the Payment Widget.

export const RestEndpointSubjects = ({subjects = []}) => {
  const subjectToIconMap = {
    'client': 'browser',
    'user:individual': 'user',
    'user:business': 'briefcase'
  };
  if (subjects.length === 0) {
    return null;
  }
  return <>
      {subjects.map(subject => <a key={subject} href="/rest-apis/authentication#subjects" className="border-0 opacity-85 hover:opacity-100 transition-opacity">
          <Badge stroke size="lg" icon={subjectToIconMap[subject]} color="gray" className="mr-1">
            {subject}
          </Badge>
        </a>)}
    </>;
};

<RestEndpointSubjects subjects={["user:individual"]} />


## OpenAPI

````yaml _media/specs/widgets-openapi.mintlify.json post /widgets/payment/sessions
openapi: 3.1.0
info:
  version: 0.1.0
  title: Widget API
  description: The Widgets API provides resources to interact with the widgets.
  contact:
    name: Uphold API Team
    email: developer@uphold.com
    url: https://developer.uphold.com
servers:
  - url: https://api.enterprise.sandbox.uphold.com
    description: Sandbox
  - url: https://api.enterprise.uphold.com
    description: Production
security:
  - OAuth2: []
tags:
  - name: Payment
    description: Payment.
  - name: Travel rule
    description: Travel rule.
  - name: KYC
    description: KYC.
paths:
  /widgets/payment/sessions:
    post:
      tags:
        - Payment
      summary: Create session
      description: Create a new session for the Payment Widget.
      operationId: widgets.create-payment-widget-session
      requestBody:
        $ref: '#/components/requestBodies/create-payment-widget-session-request-body'
      responses:
        '201':
          $ref: '#/components/responses/create-payment-widget-session-response'
        '409':
          $ref: >-
            #/components/responses/create-payment-widget-session-conflict-response
      security:
        - OAuth2:
            - widgets.payment.sessions:create
components:
  requestBodies:
    create-payment-widget-session-request-body:
      content:
        application/json:
          schema:
            type: object
            discriminator:
              propertyName: flow
              mapping:
                select-for-deposit:
                  $ref: >-
                    #/components/schemas/create-payment-widget-session-select-for-deposit-flow
                select-for-withdrawal:
                  $ref: >-
                    #/components/schemas/create-payment-widget-session-select-for-withdrawal-flow
                authorize:
                  $ref: >-
                    #/components/schemas/create-payment-widget-session-authorize-flow
            oneOf:
              - $ref: >-
                  #/components/schemas/create-payment-widget-session-select-for-deposit-flow
                title: Select for deposit
              - $ref: >-
                  #/components/schemas/create-payment-widget-session-select-for-withdrawal-flow
                title: Select for withdrawal
              - $ref: >-
                  #/components/schemas/create-payment-widget-session-authorize-flow
                title: Authorize
            required:
              - flow
          examples:
            Create Select for Deposit Session:
              value:
                flow: select-for-deposit
            Create Select for Withdrawal Session:
              value:
                flow: select-for-withdrawal
            Create Authorize Session:
              value:
                flow: authorize
                data:
                  quoteId: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
  responses:
    create-payment-widget-session-response:
      description: Session created.
      content:
        application/json:
          schema:
            type: object
            properties:
              session:
                $ref: '#/components/schemas/payment-widget-session'
            required:
              - session
          examples:
            Select for Deposit Session Created:
              value:
                session:
                  flow: select-for-deposit
                  url: https://payment.enterprise.uphold.com/
                  token: GEbRxBN...edjnXbL
            Select for Withdrawal Session Created:
              value:
                session:
                  flow: select-for-withdrawal
                  url: https://payment.enterprise.uphold.com/
                  token: GEbRxBN...edjnXbL
            Authorize Session Created:
              value:
                session:
                  flow: authorize
                  url: https://payment.enterprise.uphold.com/
                  token: GEbRxBN...edjnXbL
                  data:
                    quoteId: 623000c8-9bdf-4a2b-aa3d-6a6b44a7f6a0
      headers:
        x-uphold-request-id:
          description: >-
            A unique identifier for the request that can be shared with Uphold
            for troubleshooting purposes.
          required: true
          schema:
            type: string
            format: uuid
          examples:
            Request ID:
              value: 9092ee4d-f0fb-42e9-8787-b668dbcec531
    create-payment-widget-session-conflict-response:
      description: Business logic error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Payment Widget Not Enabled:
              value:
                code: operation_not_allowed
                message: The payment widget is not enabled for your organization
                details:
                  reasons:
                    - permission-denied
      headers:
        x-uphold-request-id:
          description: >-
            A unique identifier for the request that can be shared with Uphold
            for troubleshooting purposes.
          required: true
          schema:
            type: string
            format: uuid
          examples:
            Request ID:
              value: 9092ee4d-f0fb-42e9-8787-b668dbcec531
  schemas:
    create-payment-widget-session-select-for-deposit-flow:
      type: object
      properties:
        flow:
          description: The flow of the payment widget session.
          type: string
          enum:
            - select-for-deposit
      required:
        - flow
    create-payment-widget-session-select-for-withdrawal-flow:
      type: object
      properties:
        flow:
          description: The flow of the payment widget session.
          type: string
          enum:
            - select-for-withdrawal
      required:
        - flow
    create-payment-widget-session-authorize-flow:
      type: object
      properties:
        flow:
          description: The flow of the payment widget session.
          type: string
          enum:
            - authorize
        data:
          description: The data for the authorize flow.
          type: object
          properties:
            quoteId:
              description: The quote ID to authorize.
              type: string
              format: uuid
          required:
            - quoteId
      required:
        - flow
        - data
    payment-widget-session:
      type: object
      properties:
        flow:
          type: string
          description: The flow of the payment widget session.
          enum:
            - authorize
            - select-for-deposit
            - select-for-withdrawal
        url:
          description: The URL of the widget session that should be opened.
          type: string
          format: uri
        token:
          description: The token identifying the authenticated user.
          type: string
        data:
          type: object
          description: Additional data associated with the session.
          additionalProperties: true
      required:
        - flow
        - url
        - token
    error:
      description: The error information.
      allOf:
        - $ref: '#/components/schemas/feedback'
    feedback:
      description: A feedback message with a code and human-readable description.
      type: object
      properties:
        code:
          description: A short string with a brief explanation about the code reported.
          type: string
        message:
          description: A human-readable message providing more details.
          type: string
        details:
          description: Additional information about the feedback reported.
          type: object
          additionalProperties: true
      required:
        - code
        - message
  securitySchemes:
    OAuth2:
      type: oauth2
      description: OAuth 2.0
      flows:
        clientCredentials:
          tokenUrl: /core/oauth2/token
          scopes:
            widgets.payment.sessions:create: Grants access to create payment widget sessions.
            widgets.travel-rule.sessions:create: Grants access to create Travel Rule widget sessions.
            widgets.kyc.sessions:create: Grants access to create KYC widget sessions.

````