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

> ## Agent Instructions
> Authenticate with the raw API key in the Authorization header. Never add a Bearer prefix.
> Use the sandbox base URL https://api.test.doola.com and a dk_test_ key in examples unless the user asks for production.
> Send an Idempotency-Key header on POST /v1/partner/customers, POST /v1/partner/companies, POST /v1/partner/companies/import, POST /v1/partner/companies/{companyId}/services and POST /v1/partner/companies/{companyId}/documents. No other endpoint takes one.
> Every response is wrapped as {payload, error}. Read fields from payload and branch on error.code, never on the message.
> Drive formation progress from webhooks plus a reconciliation sweep, never a polling loop.
> Embedded SDK (@doola/js): the dk_ key stays on the server and mints customer sessions; the browser gets only a pk_ key and the session. onFormed carries only companyId and can fire more than once. Before charging, read the company with the dk_ key, require formationSubmissionStatus AWAITING_PAYMENT, check the owner's email, and price on the server. Then POST payment-confirmed, which answers 200 with an empty body, and replace the SDK element with a new doola.create() (never append a second one).
> The doola Formation MCP server at https://mcp.doola.com is for founders forming their own company with their own doola account. Platform partners integrate the Partner API or the Embedded SDK. The /mcp endpoint on this docs site only searches these docs.
> Affiliates refer founders to doola with a PartnerStack referral link and coupon code, or with two doola-branded iframe widgets: the Demo Booking Widget (app.doola.com/embed/book-demo?link=<referral link>) and the Company Formation Widget (app.doola.com/embed/partner/<partner ID>). The widgets need no API key and are not the Embedded SDK. Copy the snippets exactly as documented, never add a sandbox attribute to the formation widget iframe.
> For a full capability summary with the rules above, read https://docs.doola.com/skill.md.

# Create a customer session



## OpenAPI

````yaml /api-reference/openapi.json post /v1/partner/customer-sessions
openapi: 3.1.0
info:
  title: doola Partner API
  description: >-
    REST API for doola partners to create and manage customers and companies,
    retrieve formation documents, and look up reference data.


    Authenticate every request with a partner API key in the `Authorization`
    header. Generate keys and manage your webhook endpoint in the doola Partner
    Portal.
  contact:
    name: doola
    url: https://www.doola.com
  version: v1
servers:
  - url: https://api.test.doola.com
    description: Sandbox — use test keys (dk_test_…)
  - url: https://api.doola.com
    description: Production — use live keys (dk_live_…)
security:
  - PartnerApiKey: []
tags:
  - name: Playground (sandbox only)
    description: >-
      Sandbox-only helpers to drive a test company through the Formation and
      EinCreation milestones end to end.
  - name: Required Actions
    description: >-
      Actions doola needs you to take on a company, such as supplying new name
      options after a state rejection.
  - name: Customers
    description: Create and look up customers under your partner tenant.
  - name: Compliance
    description: Track a company's compliance obligations and their due dates.
  - name: Annual Report Filing
    description: >-
      File a company's annual report with its state: what to collect, what it
      costs, submission, confirmation and status.
  - name: Customer sessions
    description: Mint the token the doola SDK uses in your customer's browser.
  - name: Signatures
    description: Request embedded signing sessions for pending company documents.
  - name: Companies
    description: >-
      Create or import companies for your customers, then track formation
      status.
  - name: Documents
    description: List, download and upload a company's formation documents.
  - name: Companies
    description: Create companies for your customers, then track formation status.
  - name: SDK
    description: Keys for the doola Embedded SDK.
  - name: Reference data
    description: >-
      Static lookups for building company-creation requests: NAICS codes,
      states, countries, and state filing fees.
paths:
  /v1/partner/customer-sessions:
    post:
      tags:
        - Customer sessions
      summary: Create a customer session
      operationId: createSession
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerSessionRequest'
        required: true
      responses:
        '200':
          description: Token issued.
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/CustomerSessionDto'
        '400':
          description: E_VALIDATION_FAILED
        '409':
          description: >-
            E_EMAIL_IN_USE: the email cannot be this customer's, because it
            belongs to an account outside your tenant, to a non-customer
            principal such as a portal user, or to another account the customer
            would be renamed onto. E_RESOURCE_CONFLICT: the matched customer is
            bound to a different externalCustomerId, this externalCustomerId is
            bound to another customer, or the customer predates IAM and cannot
            take a new email. E_CUSTOMER_REVOKED: the customer was deactivated.
        '429':
          description: >-
            E_RATE_LIMITED: too many sessions for your tenant. Retry after the
            Retry-After header's seconds.
components:
  schemas:
    CreateCustomerSessionRequest:
      type: object
      description: Send this from your server, never the browser.
      properties:
        email:
          type: string
          description: >-
            The customer's email. If no customer exists for it under your
            tenant, one is created.
          example: founder@example.com
          minLength: 1
        externalCustomerId:
          type: string
          description: >-
            Your own id for this customer. Optional, and the recommended
            integration: it is matched before the email, so a customer who
            changes their address in your system stays the same doola customer
            instead of being provisioned again with an empty wizard. Unique per
            tenant.
          example: usr_8f21c
          maxLength: 255
          minLength: 0
        firstName:
          type: string
          description: Only used when provisioning a new customer.
          example: Ada
        lastName:
          type: string
          description: Only used when provisioning a new customer.
          example: Lovelace
        countryOfResidence:
          type: string
          description: ISO 3166-1 alpha-3. Only used when provisioning a new customer.
          example: USA
        phoneNumber:
          type: string
          description: E.164 format. Only used when provisioning a new customer.
          example: '+12125550100'
      required:
        - email
    CustomerSessionDto:
      type: object
      description: A short-lived token for one of your customers.
      properties:
        accessToken:
          type: string
          description: >-
            Return this to your frontend and hand it to the SDK. It acts only on
            this customer.
        expiresAt:
          type: string
          format: date-time
          description: When the token stops being accepted. Renew before this, not after.
        expiresIn:
          type: integer
          format: int64
          description: >-
            Remaining lifetime in seconds at mint. Schedule renewal from this,
            not from expiresAt: a relative timer keeps the end user's device
            clock out of the arithmetic.
          example: 600
  securitySchemes:
    PartnerApiKey:
      type: apiKey
      description: >-
        Partner API key. Send the raw key as the `Authorization` header value —
        e.g. `dk_test_…` in sandbox or `dk_live_…` in production. Generate and
        rotate keys in the doola Partner Portal.
      name: Authorization
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.