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

# Create a partner endpoint

> Register a partner's OCPI endpoint as a connection you own, setting each side's role, the OCPI version and token. Stays pending until you run the handshake.



## OpenAPI

````yaml /openapi/public-api.json post /connections
openapi: 3.1.0
info:
  title: ChargerDojo public API
  version: 1.0.0
  description: >-
    Automate ChargerDojo with a cdojo_ API key: register partner endpoints, run
    conformance suites and charging journeys, and read the graded reports.
servers:
  - url: https://chargerdojo.com/api/v1
security:
  - apiKey: []
tags:
  - name: Connections
  - name: Testing
  - name: Reports
  - name: Usage
  - name: Journeys
paths:
  /connections:
    post:
      tags:
        - Connections
      summary: Create a partner endpoint
      description: >-
        Register a partner's OCPI endpoint as a connection you own, setting each
        side's role, the OCPI version and token. Stays pending until you run the
        handshake.
      operationId: connections_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnection'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Connection'
        '400':
          description: Malformed input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: >-
            Your plan does not include partner endpoints, or its connection
            ceiling is reached. The body names the capability or the limit, and
            the rung above it when the ladder has one
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The local token you sent is already in use, or this organisation is
            at the fair-use ceiling on a plan that publishes none
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unsupported configuration for this target
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Quota or rate limit reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    CreateConnection:
      type: object
      required:
        - partnerBaseUrl
        - ourRole
        - theirRole
        - ocpiVersion
        - partnerEnvironment
      oneOf:
        - required:
            - tokenA
          not:
            anyOf:
              - required:
                  - tokenC
              - required:
                  - localTokenB
              - required:
                  - ourPartyId
              - required:
                  - ourCountryCode
        - required:
            - tokenC
            - ourPartyId
            - ourCountryCode
          not:
            required:
              - tokenA
      properties:
        partnerBaseUrl:
          type: string
          format: uri
        partnerEnvironment:
          type: string
          enum:
            - test
            - production
        partnerVersionsUrl:
          type: string
          format: uri
          description: >-
            Optional: their versions URL exactly as they gave it, query string
            included. Registration asks it for their version list instead of
            partnerBaseUrl followed by /versions.
        ourRole:
          type: string
          enum:
            - CPO
            - EMSP
            - HUB
            - NAP
            - NSP
            - OTHER
            - SCSP
        theirRole:
          type: string
          enum:
            - CPO
            - EMSP
            - HUB
            - NAP
            - NSP
            - OTHER
            - SCSP
        ocpiVersion:
          type: string
          enum:
            - 2.1.1
            - '2.2'
            - 2.2.1
            - 2.3.0
        tokenA:
          type: string
          description: Partner-issued registration token; never logged.
        tokenC:
          type: string
          description: >-
            The credentials token their system already issued this client; never
            logged. Use it instead of tokenA when the registration has already
            happened.
        localTokenB:
          type: string
          description: >-
            Only alongside tokenC: the token their system already authenticates
            to us with, from a registration whose record we no longer hold;
            never logged.
        ourPartyId:
          type: string
          maxLength: 3
          description: >-
            Required with tokenC: the party ID their system registered this
            client under.
        ourCountryCode:
          type: string
          minLength: 2
          maxLength: 2
          pattern: ^[A-Za-z]{2}$
          description: >-
            Required with tokenC: the ISO-3166 alpha-2 country code their system
            registered this client under.
    Connection:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
        data:
          $ref: '#/components/schemas/ConnectionView'
        meta:
          type: object
          description: Paging, on the operations that return a list.
          properties:
            limit:
              type: integer
            skip:
              type: integer
            nextCursor:
              type: string
          additionalProperties: true
    Error:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        message:
          type: string
        status:
          type: string
          enum:
            - error
        code:
          type: string
        requestId:
          type: string
        timestamp:
          type: string
          format: date-time
        capability:
          type: string
          enum:
            - external-endpoints
            - ci-handoff
            - saved-presets
            - roaming-hub-identity
            - load-testing
            - direct-payment
            - bookings
            - scheduled-runs
            - roaming-hub-relay
            - partner-profiles
        limit:
          type: object
          required:
            - id
            - used
            - cap
          properties:
            id:
              type: string
              enum:
                - connections
                - run-concurrency
            used:
              type: integer
            cap:
              type: integer
    ConnectionView:
      type: object
      additionalProperties: true
      required:
        - _id
        - partnerBaseUrl
        - ourRole
        - theirRole
        - ocpiVersion
        - status
      properties:
        _id:
          type: string
        partnerBaseUrl:
          type: string
          format: uri
        partnerEnvironment:
          type: string
          enum:
            - test
            - production
          description: >-
            Production sweeps send GET requests only. Existing external
            endpoints without a stored answer read as test.
        partnerEnvironmentConfirmed:
          type: boolean
          description: Whether a person explicitly selected test or production.
        ourRole:
          type: string
          enum:
            - CPO
            - EMSP
            - HUB
            - NAP
            - NSP
            - OTHER
            - SCSP
        theirRole:
          type: string
          enum:
            - CPO
            - EMSP
            - HUB
            - NAP
            - NSP
            - OTHER
            - SCSP
        ocpiVersion:
          type: string
          enum:
            - 2.1.1
            - '2.2'
            - 2.2.1
            - 2.3.0
        status:
          type: string
          enum:
            - pending
            - registered
            - failed
        kind:
          type: string
          enum:
            - external
            - sandbox
          description: >-
            sandbox is the built-in peer every account can run against; external
            is an endpoint you registered. Absent on connections created before
            the sandbox existed, which are external.
        lastError:
          type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: A cdojo_... API key created in the app under Settings.

````

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