> ## 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 KYC 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/kyc/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/kyc/sessions:
    post:
      tags:
        - KYC
      summary: Create session
      description: Create a new session for the KYC Widget.
      operationId: widgets.create-kyc-widget-session
      requestBody:
        $ref: '#/components/requestBodies/create-kyc-widget-session-request-body'
      responses:
        '201':
          $ref: '#/components/responses/create-kyc-widget-session-response'
        '409':
          $ref: '#/components/responses/create-kyc-widget-session-conflict-response'
      security:
        - OAuth2:
            - widgets.kyc.sessions:create
components:
  requestBodies:
    create-kyc-widget-session-request-body:
      content:
        application/json:
          schema:
            type: object
            discriminator:
              propertyName: flow
              mapping:
                verify:
                  $ref: '#/components/schemas/create-kyc-widget-session-verify-flow'
            oneOf:
              - $ref: '#/components/schemas/create-kyc-widget-session-verify-flow'
                title: Verify
          examples:
            Create Verify Session:
              value:
                flow: verify
                processes:
                  - identity
                  - proof-of-address
  responses:
    create-kyc-widget-session-response:
      description: Session created.
      content:
        application/json:
          schema:
            type: object
            properties:
              session:
                $ref: '#/components/schemas/kyc-widget-session'
            required:
              - session
          examples:
            Verify Session Created:
              value:
                session:
                  flow: verify
                  data:
                    processes:
                      - identity
                      - proof-of-address
                  token: GEbRxBN...edjnXbL
                  url: https://kyc.enterprise.uphold.com/
      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-kyc-widget-session-conflict-response:
      description: Business logic error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            KYC Widget Not Enabled:
              value:
                code: operation_not_allowed
                message: The KYC widget is not enabled for your organization
                details:
                  reasons:
                    - permission-denied
            Verification Model Not Supported:
              value:
                code: operation_not_allowed
                message: >-
                  Uphold-verified 'identity' is required to perform this
                  operation
                details:
                  reasons:
                    - uphold-verified-identity-required
            Incomplete Process Dependencies:
              value:
                code: operation_not_allowed
                message: >-
                  User cannot submit 'identity' due to incomplete process
                  dependencies
                details:
                  reasons:
                    - incomplete-profile
      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-kyc-widget-session-verify-flow:
      type: object
      properties:
        flow:
          description: The flow of the KYC widget session.
          type: string
          enum:
            - verify
        processes:
          description: >-
            The KYC processes to include in the session. Defaults to all
            widget-supported processes with the 'uphold-verified' model.
          type: array
          uniqueItems: true
          minItems: 1
          items:
            type: string
            enum:
              - identity
              - proof-of-address
      required:
        - flow
    kyc-widget-session:
      type: object
      properties:
        flow:
          description: The flow of the KYC widget session.
          type: string
          enum:
            - verify
        data:
          type: object
          description: Additional data associated with the session.
          properties:
            processes:
              description: The list of KYC processes included in the session.
              type: array
              items:
                type: string
          required:
            - processes
        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
      required:
        - flow
        - data
        - url
        - token
    error:
      description: The error information.
      type: object
      properties:
        code:
          description: >-
            A short string with a brief explanation about the error code
            reported.
          type: string
        message:
          description: A human-readable message providing more details about the error.
          type: string
        details:
          description: Additional information about the error 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.

````