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

# Create a token

> Retrieve a token



## OpenAPI

````yaml /openapi/openapi.curie.json post /oauth/token
openapi: 3.0.0
info:
  title: Nomos API
  version: 2026-05-27.curie
servers:
  - url: https://api.nomos.energy
    description: production
security: []
tags:
  - name: Plans
  - name: Leads
  - name: Subscriptions
  - name: Customers
  - name: Usage
  - name: Prices
  - name: Invoices
  - name: Smart Meter Orders
  - name: Grid Fee Reductions
  - name: Market Partners
  - name: Events
  - name: Authentication
paths:
  /oauth/token:
    post:
      tags:
        - Authentication
      summary: Create a token
      description: Retrieve a token
      requestBody:
        description: The token request
        content:
          application/json:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
                  enum:
                    - authorization_code
                    - refresh_token
                    - client_credentials
                  example: authorization_code
                  description: The OAuth 2.0 grant type being used for the token request
                code:
                  type: string
                  example: da5cece172d6a8f65f91f90b3fe65b1e
                  description: >-
                    The authorization code received from the authorization
                    server (required for authorization_code grant type)
                refresh_token:
                  type: string
                  example: ddbc4f94dbb2d19e23a81327042b35fc
                  description: >-
                    The refresh token used to obtain a new access token
                    (required for refresh_token grant type)
                client_id:
                  type: string
                  example: client_12345
                  description: >-
                    The client identifier issued to the client during
                    registration (required for public clients, when not
                    authenticating via Basic Auth)
                scope:
                  type: string
                code_verifier:
                  type: string
                  example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
                  description: >-
                    PKCE code verifier used to verify the authorization request
                    (required when PKCE was used in authorization request)
              required:
                - grant_type
      responses:
        '200':
          description: The issued access token and refresh token
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    example: >-
                      eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJhZG1pbiJdLCJwYJ0bmVyIjoi...
                    description: The access token to access the API endpoints
                  token_type:
                    type: string
                    enum:
                      - Bearer
                    example: Bearer
                    description: The type of token issued, always 'Bearer'
                  expires_in:
                    type: number
                    example: 3600
                    description: The lifetime of the access token in seconds (60 minutes)
                  refresh_token:
                    type: string
                    example: ddbc4f94dbb2d19e23a81327042b35fc
                    description: The refresh token to create a new access_token
                  scope:
                    type: string
                    example: read:* write:*
                    description: >-
                      Space-delimited list of scopes granted on this token (RFC
                      6749).
                required:
                  - access_token
                  - token_type
                  - expires_in
                  - refresh_token
                  - scope
        '400':
          description: >-
            The token request is invalid: an unknown grant type, a missing or
            expired code, or a wrong PKCE verifier.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBadRequest'
              examples:
                Unknown grant type:
                  summary: Unknown grant type
                  value:
                    code: BAD_REQUEST
                    message: >-
                      invalid_value in 'grant_type': Invalid option: expected
                      one of
                      "authorization_code"|"refresh_token"|"client_credentials"
                    requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
                    docs: >-
                      https://docs.nomos.energy/api-references/errors/BAD_REQUEST
                Authorization code grant without code:
                  summary: Authorization code grant without code
                  value:
                    code: BAD_REQUEST
                    message: >-
                      Code required for authorization_code grant type,
                      refresh_token required for refresh_token grant type
                    requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
                    docs: >-
                      https://docs.nomos.energy/api-references/errors/BAD_REQUEST
                Missing PKCE code verifier:
                  summary: Missing PKCE code verifier
                  value:
                    code: BAD_REQUEST
                    message: >-
                      Code verifier is required, as the Authorization Code flow
                      was used with PKCE
                    requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
                    docs: >-
                      https://docs.nomos.energy/api-references/errors/BAD_REQUEST
                Wrong PKCE code verifier:
                  summary: Wrong PKCE code verifier
                  value:
                    code: BAD_REQUEST
                    message: Invalid code verifier
                    requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
                    docs: >-
                      https://docs.nomos.energy/api-references/errors/BAD_REQUEST
                Body is not valid JSON:
                  $ref: '#/components/examples/400-body-is-not-valid-json'
        '401':
          description: The client credentials are missing, malformed, unknown or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrUnauthorized'
              examples:
                Revoked client:
                  $ref: '#/components/examples/401-revoked-client'
        '403':
          description: >-
            The client may not use this grant type, for example a third-party
            client asking for client_credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrForbidden'
              examples:
                Third-party client with client_credentials:
                  summary: Third-party client with client_credentials
                  value:
                    code: FORBIDDEN
                    message: >-
                      This set of credentials needs to use the Authorization
                      Code flow
                    requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
                    docs: https://docs.nomos.energy/api-references/errors/FORBIDDEN
        '500':
          description: >-
            Something went wrong on our side. Retry later, and send us the
            `requestId` if it persists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrInternalServerError'
              examples:
                Unexpected error:
                  $ref: '#/components/examples/500-unexpected-error'
      security:
        - Basic: []
components:
  schemas:
    ErrBadRequest:
      type: object
      properties:
        code:
          type: string
          enum:
            - BAD_REQUEST
          description: The error code related to the status code.
          example: BAD_REQUEST
        message:
          type: string
          description: A human readable message describing the issue.
        requestId:
          type: string
          description: The request id to be used for debugging and error reporting.
          example: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs:
          type: string
          description: The docs related to the error code.
          example: https://docs.nomos.energy/api-references/errors/BAD_REQUEST
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: >-
                  What is wrong with the field, such as `invalid_type` or
                  `asset_not_found`. `x-extensible-enum` lists the values known
                  today. New values can be added in any API version, so treat an
                  unknown value like any other error of the response's status.
                example: invalid_type
                x-extensible-enum:
                  - invalid_type
                  - too_big
                  - too_small
                  - invalid_format
                  - not_multiple_of
                  - unrecognized_keys
                  - invalid_union
                  - invalid_key
                  - invalid_element
                  - invalid_value
                  - custom
                  - unserviceable_zip
                  - ended_subscription
                  - duplicate_grid_reduction
                  - missing_smart_meter
                  - missing_module_1
                  - incompatible_grid_reduction
                  - unsupported_product
                  - unsupported_meter_order
                  - duplicate_meter_order
                  - unsupported_meter
                  - out_of_period_meter_reading
                  - unsupported_meter_reading
                  - duplicate_meter_reading
                  - implausible_meter_reading
                  - duplicate_customer_email
                  - invalid_iban
                  - upgrade_api_version
                  - withdrawal_not_allowed
                  - invalid_termination_date
                  - subscription_not_started
                  - terminated_subscription
                  - missing_household
                  - invalid_household_customer
                  - invalid_household_meter
                  - duplicate_consumption_subscription
                  - invalid_inverter
                  - read_only_asset
                  - duplicate_external_id
                  - asset_has_children
                  - asset_decommissioned
                  - asset_not_found
                  - mixed_households
                  - field_not_allowed
                  - invalid_direction
                  - duplicate_timestamp
                  - asset_not_steerable
                  - mode_not_allowed
                  - slot_missing
              field:
                type: string
                example: customer.email
              message:
                type: string
                example: 'Invalid input: expected string, received undefined'
            required:
              - code
              - field
              - message
          description: >-
            Per-field breakdown of a validation or business-rule failure.
            Omitted for API versions before the structured-errors cutoff.
      required:
        - code
        - message
        - requestId
        - docs
    ErrUnauthorized:
      type: object
      properties:
        code:
          type: string
          enum:
            - UNAUTHORIZED
          description: The error code related to the status code.
          example: UNAUTHORIZED
        message:
          type: string
          description: A human readable message describing the issue.
        requestId:
          type: string
          description: The request id to be used for debugging and error reporting.
          example: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs:
          type: string
          description: The docs related to the error code.
          example: https://docs.nomos.energy/api-references/errors/UNAUTHORIZED
      required:
        - code
        - message
        - requestId
        - docs
    ErrForbidden:
      type: object
      properties:
        code:
          type: string
          enum:
            - FORBIDDEN
          description: The error code related to the status code.
          example: FORBIDDEN
        message:
          type: string
          description: A human readable message describing the issue.
        requestId:
          type: string
          description: The request id to be used for debugging and error reporting.
          example: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs:
          type: string
          description: The docs related to the error code.
          example: https://docs.nomos.energy/api-references/errors/FORBIDDEN
      required:
        - code
        - message
        - requestId
        - docs
    ErrInternalServerError:
      type: object
      properties:
        code:
          type: string
          enum:
            - INTERNAL_SERVER_ERROR
          description: The error code related to the status code.
          example: INTERNAL_SERVER_ERROR
        message:
          type: string
          description: A human readable message describing the issue.
        requestId:
          type: string
          description: The request id to be used for debugging and error reporting.
          example: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs:
          type: string
          description: The docs related to the error code.
          example: >-
            https://docs.nomos.energy/api-references/errors/INTERNAL_SERVER_ERROR
      required:
        - code
        - message
        - requestId
        - docs
  examples:
    400-body-is-not-valid-json:
      summary: Body is not valid JSON
      value:
        code: BAD_REQUEST
        message: Malformed JSON in request body
        requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs: https://docs.nomos.energy/api-references/errors/BAD_REQUEST
    401-revoked-client:
      summary: Revoked client
      value:
        code: UNAUTHORIZED
        message: Client has been revoked
        requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs: https://docs.nomos.energy/api-references/errors/UNAUTHORIZED
    500-unexpected-error:
      summary: Unexpected error
      value:
        code: INTERNAL_SERVER_ERROR
        message: Internal Server Error
        requestId: 37a04f8f-e791-491c-81e1-86cd304649bb
        docs: https://docs.nomos.energy/api-references/errors/INTERNAL_SERVER_ERROR
  securitySchemes:
    Basic:
      type: http
      scheme: basic

````

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