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

# Create a Connect session

> Creates a Connect session, opened through Universal Links. A session is single-use and expires 48 hours after creation.

A `signup_reference` that is unknown, already used, expired, or issued for another `oem_id` or `program_id` returns `422` `signup_reference_invalid`. Create the session without it, and the customer picks the device in the OEM app.



## OpenAPI

````yaml fleet-api/reference/flatpeak-api-spec-fleet.json POST /connect-sessions
openapi: 3.0.3
info:
  description: >-
    The Flatpeak Fleet API. VPP operators use it to enroll, dispatch and settle
    OEM device fleets.


    ## Authentication

    Exchange your `account_id` and `secret_key` for a bearer token at `POST
    /auth/tokens` with basic auth. Send it as `Authorization: Bearer <token>` on
    every request.


    ## Base URL

    `https://fleet-api.flatpeak.com`


    ## Pagination

    Lists return `data`, `next_cursor` and `url`. Pass `next_cursor` as `cursor`
    until it is `null`. A cursor is opaque and bound to the endpoint and query
    parameters that issued it.


    ## Errors

    Every non-2xx response carries `object`, `type`, `code` and `message`.
    Branch on `code`.


    ## Money and energy

    Money is a decimal number paired with a `currency_code` (ISO 4217). Power is
    in kW and energy in kWh. Positive is import, negative is export.


    ## Live and test

    `live_mode` marks live or test data.
  version: 2027-01-01.busbar
  title: Flatpeak Fleet API
  termsOfService: https://flatpeak.com/legal
  contact:
    name: Technical Support
    email: support@flatpeak.com
    url: https://flatpeak.com/contact
  license:
    name: Apache 2.0
    url: https://flatpeak.com/legal
servers:
  - url: https://fleet-api.flatpeak.com
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: >-
      Exchange your account credentials for a bearer token to authenticate API
      requests.
  - name: Connect
    description: >-
      Create and retrieve Connect sessions for onboarding customers through your
      own app.
  - name: OEMs
    description: List and retrieve the OEMs whose devices your fleet can reach.
  - name: Devices
    description: >-
      Retrieve, list and update the devices connected to your account, and read
      their consent history and shared settings.
  - name: Locations
    description: >-
      Read the location a device sits behind: its timezone, currency, metering
      and your devices there.
  - name: Dispatch
    description: Submit plans to devices on managed tariffs and read the dispatch timeline.
  - name: Telemetry
    description: Read device state, device meter records and location meter records.
  - name: Tariffs
    description: Create, retrieve, delete, and list tariffs.
  - name: Events
    description: Retrieve and list account events.
  - name: VPP Programs
    description: >-
      Define and manage VPP programs: the commercial terms devices enroll under,
      and their live state.
  - name: Groups
    description: >-
      Named collections of devices for bulk dispatch and aggregated reads. OEMs
      see them read-only as [groups](/energy-api/reference/groups/list) on the
      Energy API.
  - name: Zones
    description: >-
      Network areas resolved to devices by Flatpeak, for locational eligibility
      and grouping without handling addresses.
  - name: Exports
    description: >-
      Package settlement evidence, consent records and enrollment registers as
      downloadable files.
  - name: Rewards
    description: >-
      The reward ledger: entries accrue from delivery, you approve them, pay the
      customers and mark them paid.
  - name: VPP Enrollments
    description: Track and act on device enrollments across your programs.
  - name: VPP Events
    description: >-
      Commit market activations: create an event for a group, then read its
      state and its devices' results.
externalDocs:
  description: Documentation
  url: https://docs.flatpeak.com
paths:
  /connect-sessions:
    parameters: []
    post:
      tags:
        - Connect
      summary: Create a Connect session
      description: >-
        Creates a Connect session, opened through Universal Links. A session is
        single-use and expires 48 hours after creation.


        A `signup_reference` that is unknown, already used, expired, or issued
        for another `oem_id` or `program_id` returns `422`
        `signup_reference_invalid`. Create the session without it, and the
        customer picks the device in the OEM app.
      operationId: create-connect-session
      parameters: []
      requestBody:
        $ref: '#/components/requestBodies/ConnectSessionCreate'
      responses:
        '201':
          $ref: '#/components/responses/ConnectSessionCreated'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '422':
          $ref: '#/components/responses/422'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
components:
  requestBodies:
    ConnectSessionCreate:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ConnectSessionCreate'
  responses:
    '400':
      description: >-
        400 Bad Request: the request was malformed or a required field is
        missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '401':
      description: '401 Unauthorized: authentication credentials are missing or invalid.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '403':
      description: '403 Forbidden: you do not have permission to access this resource.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '404':
      description: '404 Not Found: the requested resource does not exist.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '422':
      description: >-
        422 Unprocessable Entity: the request is well-formed but cannot be
        processed, for example missing required data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '429':
      description: '429 Too Many Requests: the rate limit has been exceeded.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: >-
        500 Internal Server Error: an unexpected error occurred. Safe to retry
        with backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '503':
      description: >-
        503 Service Unavailable: the service is temporarily down for
        maintenance. Retry after the indicated delay.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ConnectSessionCreated:
      description: Connect session created.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ConnectSession'
          example:
            id: cos_6a3196d6e61a44f33f7307ed
            object: connect_session
            live_mode: false
            oem_id: oem_6a3a8dada72cd0a249ff9528
            program_id: vpr_5c8d1f2a7b3e4d6c9a0f1b2c
            device_id: null
            target_url: https://universal.flatpeak.com
            callback_url: myapp://superenergy/flatpeak/complete
            time_created: '2026-05-05T18:37:27Z'
            time_expiry: '2026-05-07T18:37:27Z'
            account_id: acc_6a5e504c3b98d0d6739b5f72
  schemas:
    ConnectSessionCreate:
      type: object
      title: ConnectSessionCreate
      description: Parameters to create a Connect session.
      additionalProperties: false
      properties:
        oem_id:
          type: string
          example: oem_6a3a8dada72cd0a249ff9528
          description: Flatpeak identifier for the device OEM.
        callback_url:
          type: string
          example: myapp://superenergy/flatpeak/complete
          description: URL the customer returns to after they complete or exit Connect.
        program_id:
          type: string
          example: vpr_6a1f8e375db9de605baadd46
          description: >-
            Program the customer enrolls the device in. Required: a device is
            visible to you only through an enrollment in one of your programs.
        signup_reference:
          type: string
          example: sur_6a7c0e2f9b4d1a3c5e8f7b6d
          description: >-
            The `signup_reference` your program's `enrollment.signup_url`
            received, when the customer came from an OEM app. Connect then opens
            on the device the customer started from, so they do not pick it
            again. Optional. A reference works once, within 30 days of issue,
            and only with the `oem_id` and `program_id` it arrived with.
      required:
        - oem_id
        - callback_url
        - program_id
    ConnectSession:
      type: object
      title: ConnectSession
      description: >-
        A Connect session. Returned on creation and on retrieval; `device_id` is
        populated once the customer completes Connect.
      properties:
        id:
          type: string
          description: Flatpeak Connect Session ID.
          example: cos_6a3196d6e61a44f33f7307ed
        object:
          type: string
          description: Object type, `connect_session`.
          example: connect_session
          enum:
            - connect_session
        live_mode:
          type: boolean
          description: '`true` for live data, `false` for test data.'
          example: false
        oem_id:
          type: string
          pattern: ^oem_[A-Za-z0-9]+$
          example: oem_6a3a8dada72cd0a249ff9528
          description: >-
            Flatpeak OEM ID: the OEM the customer signs in with. Fixed for the
            session.
        program_id:
          type: string
          example: vpr_5c8d1f2a7b3e4d6c9a0f1b2c
          description: Program the customer enrolls the device in.
        device_id:
          type: string
          description: >-
            The connected device; `null` until the customer completes Connect or
            if they exit.
          example: dev_63a6087272941ef077a8fd3e
          nullable: true
        target_url:
          type: string
          example: https://universal.flatpeak.com
          description: >-
            URL to redirect the customer to, with the session ID appended as
            `connect_session`, for example
            `https://universal.flatpeak.com/?connect_session=cos_6a3196d6e61a44f33f7307ed`.
        callback_url:
          type: string
          example: myapp://superenergy/flatpeak/complete
          description: URL the customer returns to after they complete or exit Connect.
        time_created:
          type: string
          description: Time when the object was created, in UTC.
          example: '2026-05-05T18:37:27Z'
          format: date-time
        time_expiry:
          type: string
          example: '2026-05-07T18:37:27Z'
          description: 'Time when the session expires, in UTC: 48 hours after creation.'
          format: date-time
        account_id:
          type: string
          pattern: ^[a-z]{2,4}_[A-Za-z0-9]+$
          example: acc_6a5e504c3b98d0d6739b5f72
          description: Flatpeak Account ID of the operator that owns the Connect session.
      required:
        - id
        - object
        - live_mode
        - oem_id
        - program_id
        - device_id
        - target_url
        - callback_url
        - time_created
        - time_expiry
        - account_id
    Error:
      type: object
      description: Standard error envelope returned by every non-2xx response.
      required:
        - object
        - type
        - code
        - message
      properties:
        object:
          type: string
          enum:
            - error
          default: error
          description: Object type.
        type:
          type: string
          description: High-level error category.
          example: invalid_request
        code:
          type: string
          description: Machine-readable error code, safe to branch on.
          example: access_denied
        message:
          type: string
          description: Human-readable description of the error.
          example: The requested resource could not be found.
        context:
          type: string
          description: Optional originating context, for example `api.price_get`.
          example: api.price_get
        live_mode:
          type: boolean
          description: Whether the error occurred against live or test data.
        time_created:
          type: string
          format: date-time
          description: Time the error was generated (RFC 3339).
          example: '2026-01-01T00:00:00Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authenticate with the `bearer_token` obtained from the
        [authentication](/fleet-api/reference/authentication) endpoint.

````

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