openapi: 3.0.0
info:
  title: INVERS Credentials API
  description: |
    The Credentials API is intended for INVERS customers who need programmatic access to integrate their applications with the INVERS platform.

    The base URL for all endpoints described here is `https://api.invers.com`. Learn more in our [Integration Guide](https://developers.invers.com/integration-guide/) and [common API rules](https://developers.invers.com/integration-guide/api-basics/).

    The Credentials API allows you to manage credentials for vehicles integrated via OEM APIs.
    These credentials are used by INVERS services to communicate with the telematics manufacturer's cloud or with the telematics unit directly.

    For example whenever a command is sent via the Vehicle Commands API to a Mercedes Vehicle,
    the command has to be mapped and sent to the appropriate endpoint of the Mercedes API,
    which requires the credentials provided through this API.
  contact:
    name: INVERS GmbH
    url: https://developers.invers.com/vehicle-management/vehicle-lifecycle/managing-credentials/
  version: 7.2.0
  x-api-id: dee8edf6-f5f2-11eb-9a03-0242ac130003
  x-audience: external-public
servers:
  - url: https://api.invers.com
    description: INVERS OneAPI
tags:
  - name: Credentials
    description: These resources can be used to manage credentials.
externalDocs:
  description: Find out more about the Credentials API in our documentation.
  url: https://developers.invers.com/vehicle-management/vehicle-lifecycle/managing-credentials/
paths:
  /telematics-brands/{brand}/credentials:
    get:
      tags:
        - Credentials
      summary: Get list of credentials
      description: |
        Returns a list of credentials for the brand specified with `brand`.
        If no credentials are stored, an empty list will be returned.

        The brands that support this endpoint are `TESLA`, `MERCEDES`, `NIU` and `SEGWAY`.
      operationId: get-credentials-list
      responses:
        '200':
          description: A list of all credentials.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/TeslaCredentialsList'
                  - $ref: '#/components/schemas/MercedesClientCredentialsList'
                  - $ref: '#/components/schemas/ClientCredentialsList'
                  - $ref: '#/components/schemas/PasswordCredentialsList'
              examples:
                Tesla owner credentials:
                  value:
                    items:
                      - id: 01F62857KMPG2NE2GK1W2N3QYS
                        name: TeslaOwnerID 3
                        region: EU
                        authorize_application_link: https://auth.tesla.com/oauth2/v3/authorize?client_id=3c85f573-bf96-4419-8b50-1db4a6abba51&redirect_uri=https://api.invers.com/path&response_type=code&scope=openid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds&state=01F62857KMPG2NE2GK1W2N3QYS
                        authorize_application_completed: false
                        authorization_status: PENDING
                        last_changed_at: '2025-05-28T10:29:00Z'
                        usage_count: 0
                      - id: 01F6285K89VS0NG10M56GC8H4Y
                        name: TeslaOwnerID 4
                        region: EU
                        authorize_application_link: https://auth.tesla.com/oauth2/v3/authorize?client_id=3c85f573-bf96-4419-8b50-1db4a6abba51&redirect_uri=https://api.invers.com/path&response_type=code&scope=openid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds&state=01F6285K89VS0NG10M56GC8H4Y
                        authorize_application_completed: true
                        authorization_status: AUTHORIZED
                        last_changed_at: '2025-05-28T11:29:00Z'
                        usage_count: 0
                      - id: 01F6285XSGQY59MRC9PPAJV7WP
                        name: TeslaOwnerID 5
                        region: EU
                        authorize_application_link: https://auth.tesla.com/oauth2/v3/authorize?client_id=3c85f573-bf96-4419-8b50-1db4a6abba51&redirect_uri=https://api.invers.com/path&response_type=code&scope=openid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds&state=01F6285XSGQY59MRC9PPAJV7WP
                        authorize_application_completed: false
                        authorization_status: REVOKED
                        revoked_at: '2025-06-29T17:29:00Z'
                        last_changed_at: '2025-05-28T10:29:00Z'
                        usage_count: 0
                Tesla business credentials:
                  value:
                    items:
                      - id: 01F62857KMPG2NE2GK1W2N3QYS
                        name: MyCompany business credentials
                        region: EU
                        client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                        last_changed_at: '2025-05-28T10:29:00Z'
                        usage_count: 0
                Mercedes client credentials:
                  value:
                    items:
                      - id: 01F62857KMPG2NE2GK1W2N3QYS
                        name: Production fleet
                        client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                        client_name: client1
                        last_changed_at: '2021-03-08T10:29:00Z'
                        usage_count: 0
                Client credentials:
                  value:
                    items:
                      - id: 01F62857KMPG2NE2GK1W2N3QYS
                        name: NIU fleet Berlin
                        client_id: client1
                        last_changed_at: '2021-03-08T10:29:00Z'
                        usage_count: 0
                Password credentials:
                  value:
                    items:
                      - id: 01F62857KMPG2NE2GK1W2N3QYS
                        name: NIU fleet Berlin
                        last_changed_at: '2021-03-08T10:29:00Z'
                        usage_count: 0
                        client_id: client1
                        username: user1
        '404':
          description: |
            The specified telematics `brand` was not found or it does not support this resource. See examples for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                The specified telematics brand was not found:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The telematics brand 'new' is not supported.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The telematics brand does not support this resource:
                  value:
                    type: /problems/unknown-resource
                    title: The requested resource does not exist.
                    status: 404
                    detail: The resource '/credentials' does not exist.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
      security:
        - OAuth2:
            - VEHICLE_LIFECYCLE
      x-invers-permission: telematics-creds.ro
    post:
      tags:
        - Credentials
      summary: Store credentials
      description: |
        Stores the credentials required for communicating with the telematics units
        for the brand specified with `brand`.

        Note that storing credentials that are identical to existing credentials
        will result in a **201** response instead of an error.

        The brands that support this endpoint are `TESLA`, `MERCEDES`, `NIU` and `SEGWAY`.
      requestBody:
        description: The credentials to be stored.
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/PostTeslaOwnerCredentials'
                - $ref: '#/components/schemas/PostMercedesClientCredentials'
                - $ref: '#/components/schemas/PostClientCredentials'
                - $ref: '#/components/schemas/PostPasswordCredentials'
            examples:
              Tesla owner credentials:
                value:
                  name: TeslaOwnerID 3
                  region: EU
              Mercedes client credentials:
                value:
                  name: Production fleet
                  client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                  client_name: client1
                  client_secret: supersecret
              Client credentials:
                value:
                  name: NIU fleet Berlin
                  client_id: client1
                  client_secret: supersecret
              Password credentials:
                value:
                  name: NIU fleet Berlin
                  client_id: client1
                  client_secret: supersecret
                  username: user1
                  password: also super secret
      operationId: create-credentials
      responses:
        '201':
          description: The credentials have been created.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/TeslaOwnerCredentials'
                  - $ref: '#/components/schemas/MercedesClientCredentials'
                  - $ref: '#/components/schemas/ClientCredentials'
                  - $ref: '#/components/schemas/PasswordCredentials'
              examples:
                Tesla owner credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: TeslaOwnerID 3
                    region: EU
                    authorize_application_link: https://auth.tesla.com/oauth2/v3/authorize?client_id=3c85f573-bf96-4419-8b50-1db4a6abba51&redirect_uri=https://api.invers.com/path&response_type=code&scope=openid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds&state=01F62857KMPG2NE2GK1W2N3QYS
                    authorize_application_completed: false
                    authorization_status: PENDING
                    last_changed_at: '2025-05-28T10:29:00Z'
                    usage_count: 0
                Mercedes client credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: Production fleet
                    client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                    client_name: client1
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                Client credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: NIU fleet Berlin
                    client_id: client1
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                Password credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: NIU fleet Berlin
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                    client_id: client1
                    username: user1
        '400':
          description: The request is invalid. See example for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/validation-error
                title: Validation Error
                status: 400
                detail: The credentials are invalid according to the telematics unit manufacturer.
                flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
        '404':
          description: |
            The specified telematics `brand` was not found or it does not support this resource. See examples for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                The specified telematics brand was not found:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The telematics brand 'new' is not supported.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The telematics brand does not support this resource:
                  value:
                    type: /problems/unknown-resource
                    title: The requested resource does not exist.
                    status: 404
                    detail: The resource '/credentials' does not exist.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
        '409':
          description: The request conflicts with existing credentials. See example for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/unique-identifier-already-exists
                title: Unique identifier already exists
                status: 409
                detail: The credentials with name 'NIU fleet Berlin' already exist.
                flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
        '429':
          description: |
            Too many requests have been sent to a third-party API endpoint required to complete this request.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/third-party/too-many-requests
                title: The client has caused too many requests to a third-party API and is temporarily blocked.
                status: 429
                detail: Too many requests were sent to the NIU API.
                flow_id: 268de5ff-b700-4e1b-8ebc-b2d935782d93
        '502':
          description: |
            An error occurred at a third party API. See example for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/third-party/error
                title: An error occurred at a third party API or protocol.
                status: 502
                detail: Unable to authenticate the credentials due to an error at a third party API.
                flow_id: 268de5ff-b700-4e1b-8ebc-b2d935782d93
      security:
        - OAuth2:
            - VEHICLE_LIFECYCLE
      x-invers-permission: telematics-creds
    parameters:
      - name: brand
        in: path
        description: |
          Name of the telematics brand.
        x-extensible-enum:
          - tesla
          - mercedes
          - niu
          - segway
        required: true
        schema:
          type: string
          maxLength: 64
          example: niu
  /telematics-brands/{brand}/credentials/{credentials_id}:
    get:
      tags:
        - Credentials
      summary: Get credentials by ID
      description: |
        Returns the credentials with `credentials_id` for the brand specified with `brand`.

        The brands that support this endpoint are `TESLA`, `MERCEDES`, `NIU` and `SEGWAY`.
      operationId: get-credentials-by-id
      responses:
        '200':
          description: The requested credentials.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/TeslaOwnerCredentials'
                  - $ref: '#/components/schemas/TeslaBusinessCredentials'
                  - $ref: '#/components/schemas/MercedesClientCredentials'
                  - $ref: '#/components/schemas/ClientCredentials'
                  - $ref: '#/components/schemas/PasswordCredentials'
              examples:
                Tesla owner credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: TeslaOwnerID 3
                    region: EU
                    authorize_application_link: https://auth.tesla.com/oauth2/v3/authorize?client_id=3c85f573-bf96-4419-8b50-1db4a6abba51&redirect_uri=https://api.invers.com/path&response_type=code&scope=openid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds&state=01F62857KMPG2NE2GK1W2N3QYS
                    authorize_application_completed: false
                    authorization_status: PENDING
                    last_changed_at: '2025-05-28T10:29:00Z'
                    usage_count: 0
                Tesla business credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: MyCompany business credentials
                    region: EU
                    client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                    last_changed_at: '2025-05-28T10:29:00Z'
                    usage_count: 0
                Mercedes client credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: Production fleet
                    client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                    client_name: client1
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                Client credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: NIU fleet Berlin
                    client_id: client1
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                Password credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: NIU fleet Berlin
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                    client_id: client1
                    username: user1
        '404':
          description: |
            The specified telematics `brand` was not found,
            the telematics `brand` does not support this resource
            or the credentials specified by `credentials_id` were not found.
            See examples for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                The credentials do not exist:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The credentials with ID '01F6285XSGQY59MRC9PPAJV7WP' cannot be found.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The specified telematics brand was not found:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The telematics brand 'new' is not supported.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The telematics brand does not support this resource:
                  value:
                    type: /problems/unknown-resource
                    title: The requested resource does not exist.
                    status: 404
                    detail: The resource '/credentials' does not exist.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
      security:
        - OAuth2:
            - VEHICLE_LIFECYCLE
      x-invers-permission: telematics-creds.ro
    patch:
      tags:
        - Credentials
      summary: Update credentials
      description: |
        Updates the credentials required for communicating with the telematics units
        for the brand specified with `brand`.

        Note: The `client_id` cannot be modified.

        The brands that support this endpoint are `MERCEDES`, `NIU` and `SEGWAY`.
      requestBody:
        description: The new secret to be stored.
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/PatchMercedesClientCredentials'
                - $ref: '#/components/schemas/PatchClientCredentials'
                - $ref: '#/components/schemas/PatchPasswordCredentials'
            examples:
              Client credentials:
                value:
                  client_secret: different secret
              Password credentials:
                description: You can set any non-empty subset of the three values given here.
                value:
                  client_secret: different secret
                  username: different username
                  password: different secret
      operationId: patch-credentials
      responses:
        '200':
          description: The credentials have been updated.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/MercedesClientCredentials'
                  - $ref: '#/components/schemas/ClientCredentials'
                  - $ref: '#/components/schemas/PasswordCredentials'
              examples:
                Mercedes client credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: Production fleet
                    client_id: 32CFA77D-3B39-4026-BED4-581F132FFFA5
                    client_name: client1
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                Client credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: NIU fleet Berlin
                    client_id: client1
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                Password credentials:
                  value:
                    id: 01F62857KMPG2NE2GK1W2N3QYS
                    name: NIU fleet Berlin
                    last_changed_at: '2021-03-08T10:29:00Z'
                    usage_count: 0
                    client_id: client1
                    username: user1
        '400':
          description: The request is invalid. See example for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/validation-error
                title: Validation Error
                status: 400
                detail: The credentials are invalid according to the telematics unit manufacturer.
                flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
        '404':
          description: |
            The specified telematics `brand` was not found,
            the telematics `brand` does not support this resource
            or the credentials specified by `credentials_id` were not found.
            See examples for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                The credentials do not exist:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The credentials with ID '01F6285XSGQY59MRC9PPAJV7WP' cannot be found.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The specified telematics brand was not found:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The telematics brand 'new' is not supported.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The telematics brand does not support this resource:
                  value:
                    type: /problems/unknown-resource
                    title: The requested resource does not exist.
                    status: 404
                    detail: The resource '/credentials' does not exist.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
        '429':
          description: |
            Too many requests have been sent to a third-party API endpoint required to complete this request.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/third-party/too-many-requests
                title: The client has caused too many requests to a third-party API and is temporarily blocked.
                status: 429
                detail: Too many requests were sent to the NIU API.
                flow_id: 268de5ff-b700-4e1b-8ebc-b2d935782d93
        '502':
          description: |
            An error occurred at a third party API. See example for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/third-party/error
                title: An error occurred at a third party API or protocol.
                status: 502
                detail: Unable to authenticate the credentials due to an error at a third party API.
                flow_id: 268de5ff-b700-4e1b-8ebc-b2d935782d93
      security:
        - OAuth2:
            - VEHICLE_LIFECYCLE
      x-invers-permission: telematics-creds
    delete:
      tags:
        - Credentials
      summary: Delete credentials
      description: |
        Deletes the credentials with the specified `credentials_id` for the brand specified with `brand`.

        The brands that support this endpoint are `TESLA`, `MERCEDES`, `NIU` and `SEGWAY`.
      operationId: delete-credentials
      responses:
        '204':
          description: The credentials specified by `credentials_id` were deleted successfully.
        '404':
          description: |
            The specified telematics `brand` was not found,
            the telematics `brand` does not support this resource
            or the credentials specified by `credentials_id` were not found.
            See examples for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                The credentials do not exist:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The credentials with ID '01F6285XSGQY59MRC9PPAJV7WP' cannot be found.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The specified telematics brand was not found:
                  value:
                    type: /problems/resource-not-found
                    title: The resource cannot be found.
                    status: 404
                    detail: The telematics brand 'new' is not supported.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
                The telematics brand does not support this resource:
                  value:
                    type: /problems/unknown-resource
                    title: The requested resource does not exist.
                    status: 404
                    detail: The resource '/credentials' does not exist.
                    flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
        '409':
          description: The request conflicts with the credentials state. See example for more details.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: /problems/unique-identifier-already-exists
                title: Request cannot be processed due to a conflicting resource or resource state.
                status: 409
                detail: Cannot delete the credentials with name 'NIU fleet Berlin', since they are already being used.
                flow_id: 5e77e3e3-48ab-4955-8ab3-1c62339096ab
      security:
        - OAuth2:
            - VEHICLE_LIFECYCLE
      x-invers-permission: telematics-creds
    parameters:
      - name: brand
        in: path
        description: |
          Name of the telematics brand.
        x-extensible-enum:
          - tesla
          - mercedes
          - niu
          - segway
        required: true
        schema:
          type: string
          maxLength: 64
          example: niu
      - name: credentials_id
        in: path
        description: The ID of the credentials.
        required: true
        schema:
          type: string
          maxLength: 40
          example: 01F62857KMPG2NE2GK1W2N3QYS
components:
  schemas:
    IdProperty:
      type: string
      description: A generated unique identifier for the credentials which can be used to reference the credentials in API requests.
      maxLength: 40
      example: 01F62857KMPG2NE2GK1W2N3QYS
    LastChangedAtProperty:
      type: string
      description: UTC time of when the credentials were last changed.
      format: date-time
      example: '2021-03-08T10:29:00Z'
    UsageCountProperty:
      type: integer
      format: int32
      description: The number of telematics units using these credentials.
      example: 0
    NameProperty:
      type: string
      description: Used to reference the credentials in UIs or API responses more comfortably and should therefore be descriptive and unique.
      maxLength: 70
      example: Tesla fleet Berlin
    ClientIdProperty:
      type: string
      description: The client ID used for authentication at the telematics manufacturer's cloud.
      maxLength: 70
      example: client1
    ClientNameProperty:
      type: string
      description: The name of the client according to the telematics manufacturer's cloud.
      maxLength: 70
      example: client1
    ClientSecretProperty:
      type: string
      description: The client secret used to obtain a token from the telematics manufacturer's cloud.
      maxLength: 70
      example: supersecret
    UsernameProperty:
      type: string
      description: The username used for authentication at the telematics manufacturer's cloud.
      maxLength: 70
      example: user1
    PasswordProperty:
      type: string
      description: The user password used to obtain a token from the telematics manufacturer's cloud.
      maxLength: 70
      example: supersecret
    PostMercedesClientCredentials:
      required:
        - name
        - client_id
        - client_name
        - client_secret
      properties:
        name:
          $ref: '#/components/schemas/NameProperty'
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        client_name:
          $ref: '#/components/schemas/ClientNameProperty'
        client_secret:
          $ref: '#/components/schemas/ClientSecretProperty'
    PostClientCredentials:
      required:
        - name
        - client_id
        - client_secret
      properties:
        name:
          $ref: '#/components/schemas/NameProperty'
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        client_secret:
          $ref: '#/components/schemas/ClientSecretProperty'
    PostPasswordCredentials:
      required:
        - name
        - client_id
        - client_secret
        - username
        - password
      properties:
        name:
          $ref: '#/components/schemas/NameProperty'
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        client_secret:
          $ref: '#/components/schemas/ClientSecretProperty'
        username:
          $ref: '#/components/schemas/UsernameProperty'
        password:
          $ref: '#/components/schemas/PasswordProperty'
    PostTeslaOwnerCredentials:
      required:
        - name
        - region
      properties:
        name:
          type: string
          description: |
            Used to reference the credentials in UIs or API responses more comfortably.
            The name must be unique.
            For example, you can use an internal ID that identifies the Tesla owner in your system.
            Do not use personal information.
          maxLength: 70
          example: TeslaOwnerID 3
        region:
          type: string
          description: |
            Region that the Tesla is used in.

            - EU includes Europe, Middle East and Africa
            - NA includes North America and Asia-Pacific (excluding China)
          maxLength: 40
          x-extensible_enum:
            - EU
            - NA
          example: EU
    PatchClientCredentials:
      required:
        - client_secret
      properties:
        client_secret:
          $ref: '#/components/schemas/ClientSecretProperty'
    PatchMercedesClientCredentials:
      properties:
        client_secret:
          $ref: '#/components/schemas/ClientSecretProperty'
        client_name:
          $ref: '#/components/schemas/ClientNameProperty'
    PatchPasswordCredentials:
      properties:
        client_secret:
          $ref: '#/components/schemas/ClientSecretProperty'
        username:
          $ref: '#/components/schemas/UsernameProperty'
        password:
          $ref: '#/components/schemas/PasswordProperty'
    MercedesClientCredentials:
      required:
        - id
        - name
        - client_id
        - client_name
        - last_changed_at
        - usage_count
      properties:
        id:
          $ref: '#/components/schemas/IdProperty'
        name:
          $ref: '#/components/schemas/NameProperty'
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        client_name:
          $ref: '#/components/schemas/ClientNameProperty'
        last_changed_at:
          $ref: '#/components/schemas/LastChangedAtProperty'
        usage_count:
          $ref: '#/components/schemas/UsageCountProperty'
    ClientCredentials:
      required:
        - id
        - name
        - client_id
        - last_changed_at
        - usage_count
      properties:
        id:
          $ref: '#/components/schemas/IdProperty'
        name:
          $ref: '#/components/schemas/NameProperty'
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        last_changed_at:
          $ref: '#/components/schemas/LastChangedAtProperty'
        usage_count:
          $ref: '#/components/schemas/UsageCountProperty'
    PasswordCredentials:
      required:
        - id
        - name
        - client_id
        - last_changed_at
        - usage_count
      properties:
        id:
          $ref: '#/components/schemas/IdProperty'
        name:
          $ref: '#/components/schemas/NameProperty'
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        username:
          $ref: '#/components/schemas/UsernameProperty'
        last_changed_at:
          $ref: '#/components/schemas/LastChangedAtProperty'
        usage_count:
          $ref: '#/components/schemas/UsageCountProperty'
    TeslaBusinessCredentials:
      required:
        - id
        - name
        - region
        - client_id
        - last_changed_at
        - usage_count
      properties:
        id:
          $ref: '#/components/schemas/IdProperty'
        name:
          $ref: '#/components/schemas/NameProperty'
        region:
          type: string
          description: |
            Region that the Tesla is used in.

            - EU includes Europe, Middle East and Africa
            - NA includes North America and Asia-Pacific (excluding China)
          maxLength: 40
          x-extensible_enum:
            - EU
            - NA
          example: EU
        client_id:
          $ref: '#/components/schemas/ClientIdProperty'
        last_changed_at:
          $ref: '#/components/schemas/LastChangedAtProperty'
        usage_count:
          $ref: '#/components/schemas/UsageCountProperty'
    TeslaOwnerCredentials:
      required:
        - id
        - name
        - region
        - authorize_application_link
        - authorize_application_completed
        - authorization_status
        - last_changed_at
        - usage_count
      properties:
        id:
          $ref: '#/components/schemas/IdProperty'
        name:
          type: string
          description: |
            Used to reference the credentials in UIs or API responses more comfortably.
            The name must be unique.
            For example, you can use an internal ID that identifies the Tesla owner in your system.
            Do not use personal information.
          maxLength: 70
          example: TeslaOwnerID 3
        region:
          type: string
          description: |
            Region that the Tesla is used in.

            - EU includes Europe, Middle East and Africa
            - NA includes North America and Asia-Pacific (excluding China)
          maxLength: 40
          x-extensible_enum:
            - EU
            - NA
          example: EU
        authorize_application_link:
          type: string
          description: |
            This link must be sent to the Tesla owner.
            By clicking on the link and following the instructions
            the owner can authorize INVERS as a third party application,
            which gives INVERS limited access to the Tesla vehicles linked to the owner's Tesla account.

            This link can also be used to re-authorize the INVERS application,
            in case the authorization has been revoked for any reason,
            or required scopes haven't been granted / were removed.
          maxLength: 500
          example: https://auth.tesla.com/oauth2/v3/authorize?client_id=3c85f573-bf96-4419-8b50-1db4a6abba51&redirect_uri=https://api.invers.com/path&response_type=code&scope=openid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds&state=01F62857KMPG2NE2GK1W2N3QYS
        authorize_application_completed:
          deprecated: true
          type: boolean
          description: |
            **Deprecated**: Use `authorization_status` instead.

            Whether the Tesla owner has successfully authorized INVERS as a third party application,
            i.e. whether they have clicked on the `authorize_application_link` and followed the instructions.
            If this value is `true`, the credentials are ready for use.
            The Tesla owner can revoke the authorization at any time.
            In case they do, this value will change to `false`.
          example: false
        authorization_status:
          type: string
          description: |
            Status of the authorization process.

            After the credentials have been created the status is `PENDING`.

            Once the Tesla owner clicks the `authorize_application_link` and completes the steps as instructed,
            the credentials become ready for use and the status changes to `AUTHORIZED`.

            The Tesla owner can revoke the authorization at any time,
            in which case the status changes to `REVOKED`.
            There are also cases, where certain changes to the Tesla account security settings, will revoke authorization.
            This makes the credentials unusable for our application,
            and all associated vehicles will be unable to execute vehicle commands.

            The status `SCOPES_MISSING` indicates that the Tesla owner hasn't granted our application all required scopes.
            In this case all vehicles using these credentials, may provide degraded functionality.
            This can cause operational issues, e.g. during rentals.
          maxLength: 40
          x-extensible_enum:
            - PENDING
            - AUTHORIZED
            - REVOKED
            - SCOPES_MISSING
          example: PENDING
        revoked_at:
          type: string
          description: UTC time of when authorization for the INVERS third party application was revoked.
          format: date-time
          example: '2025-08-01T11:47:00Z'
        last_changed_at:
          $ref: '#/components/schemas/LastChangedAtProperty'
        usage_count:
          $ref: '#/components/schemas/UsageCountProperty'
    MercedesClientCredentialsList:
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/MercedesClientCredentials'
    ClientCredentialsList:
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ClientCredentials'
    PasswordCredentialsList:
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/PasswordCredentials'
    TeslaCredentialsList:
      required:
        - items
      properties:
        items:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/TeslaOwnerCredentials'
              - $ref: '#/components/schemas/TeslaBusinessCredentials'
    Problem:
      type: object
      required:
        - type
        - title
        - status
        - detail
      properties:
        type:
          type: string
          format: uri-reference
          description: |
            A relative URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferencable and point to a human-readable documentation nor globally unique for the problem type.
          default: about:blank
          example: /problem/connection-error
        type_documentation:
          type: string
          format: url
          description: |
            An URL that points to a human-readable documentation of the problem type. Some explanations of the problem type together with possible solutions can be found there.  Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
          example: https://developers.invers.com/problems/invalid-credentials/
        title:
          type: string
          description: |
            A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
          example: Service Unavailable
        status:
          type: integer
          format: int32
          description: |
            The HTTP status code generated by the origin server for this occurrence of the problem.
          minimum: 100
          maximum: 600
          exclusiveMaximum: true
          example: 503
        detail:
          type: string
          description: |
            A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
          example: Connection to database timed out
        flow_id:
          type: string
          description: |
            The id of the flow that caused this error.  For more information visit [https://developers.invers.com/integration-guide/api-basics/#flow-id](https://developers.invers.com/integration-guide/api-basics/#flow-id).
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /auth/oauth/token
          scopes:
            VEHICLE_LIFECYCLE: Manage telematics unit credentials
        authorizationCode:
          authorizationUrl: /auth/oauth/authorize
          tokenUrl: /auth/oauth/token
          scopes:
            VEHICLE_LIFECYCLE: Manage telematics unit credentials
