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

# Transfer a charging key

> Transfers a charging key from its current fleet to another existing fleet. The target fleet must belong to the same EMP parent as the source fleet and must already have an external payment option configured.



## OpenAPI

````yaml reference/openapi.json PUT /emp/v1/charging-keys/{keyIdentifier}/transfer
openapi: 3.1.0
info:
  title: Drive API
  version: 1.0.0
  description: >-
    The Drive API provides comprehensive access to Plugsurfing's charging
    infrastructure network. It enables you to manage users, charging keys,
    search for charging locations, handle payments, and control charging
    sessions.
servers:
  - url: https://{environment}.plugsurfing.com
    variables:
      environment:
        enum:
          - drive-api-stage
        default: drive-api-stage
        description: >-
          API environment - use drive-api-stage for testing and drive-api for
          production
security: []
tags:
  - name: Geosearch
    description: >-
      Search and retrieve detailed information about charging locations and
      stations
  - name: Users
    description: >-
      Manage user accounts including creation, retrieval, updates, and deletion.
      Handles user-specific data and preferences.
  - name: Charging Keys
    description: >-
      Manage physical and virtual charging keys including creation, activation,
      updates, and status management. Essential for user access to charging
      stations.
  - name: Sessions
    description: >-
      Access and manage charging session data including history, status, and
      detailed session information
  - name: Remote Charging
    description: >-
      Control charging sessions remotely including starting and stopping
      sessions, and monitoring session status
  - name: Payment Options
    description: >-
      Manage payment methods and handle transaction processing for charging
      services
  - name: User Groups
    description: Manage user group memberships
  - name: Vouchers
    description: Redeem vouchers
  - name: Charging Key Orders
    description: Handle the ordering and fulfillment process for physical charging keys
  - name: EMP Charging Keys
    description: E-Mobility Provider specific endpoints for managing charging keys
  - name: EMP Geosearch
    description: E-Mobility Provider specific endpoints for location search and information
  - name: EMP Orders
    description: E-Mobility Provider specific endpoints for managing orders
  - name: EMP Sessions
    description: E-Mobility Provider specific endpoints for managing charging sessions
  - name: EMP Fleets
    description: E-Mobility Provider specific endpoints for managing fleets
paths:
  /emp/v1/charging-keys/{keyIdentifier}/transfer:
    put:
      tags:
        - EMP Charging Keys
      summary: Transfer a charging key
      description: >-
        Transfers a charging key from its current fleet to another existing
        fleet.


        **Business rules:**

        - Only charging keys that currently belong to a fleet can be
        transferred.

        - The target fleet must belong to the same EMP parent as the source
        fleet.

        - The target fleet must already have an external payment option
        configured.

        - Transferring to the same fleet is idempotent and returns `200 OK`.
      operationId: transferEmpChargingKey
      parameters:
        - name: keyIdentifier
          in: path
          description: keyIdentifier provided when creating the charging key
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmpChargingKeyTransferRequest'
            example:
              targetFleetId: a2mPQRst8x
        required: true
      responses:
        '200':
          description: Charging key transferred successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmpChargingKeyResponse'
              example:
                name: SE6F1K2C3
                keyIdentifier: 3633e0e0
                validTo: '2022-01-24T11:25:54.210Z'
                fleetId: a2mPQRst8x
                contractId: DE-9FS-C045DS363-E
                visualNumber: '6285629402937'
                enabled: true
                whitelist: NEVER
        '400':
          description: >-
            Bad request. Possible causes:

            - Missing or invalid request body.

            - Charging key does not belong to a fleet (`Charging key must belong
            to a fleet`).

            - Target fleet has no external payment option (`Target fleet must
            have an external payment option`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Charging key must belong to a fleet
        '403':
          description: >-
            Forbidden. The target fleet belongs to a different EMP parent than
            the source fleet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Target fleet belongs to a different EMP
        '404':
          description: Source charging key or target fleet not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Resource not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Resource not found
      security:
        - ApiKeyAuth: []
components:
  schemas:
    EmpChargingKeyTransferRequest:
      type: object
      required:
        - targetFleetId
      properties:
        targetFleetId:
          type: string
          example: y1nNLJqb7m
          description: >-
            Customer-facing external ID of the fleet to transfer the charging
            key into. The target fleet must exist, belong to the same EMP parent
            as the source fleet, and already have an external payment option
            configured.
      description: Request payload to transfer an EMP charging key to another fleet.
    EmpChargingKeyResponse:
      properties:
        name:
          type: string
          example: SE6F1K2C3
          description: Name of the Charging key
        keyIdentifier:
          type: string
          example: 3633e0e0
          description: >-
            Charging key identifier in hexadecimal, little-endian format with
            usually 8 or 14 characters.
        validTo:
          type: string
          format: date-time
          example: '2022-01-24T11:25:54.210Z'
          description: UTC timestamp when the charging key expires.
        fleetId:
          type: string
          example: y1nNLJqb7m
          description: Fleet id
        contractId:
          type: string
          example: DE-9FS-C045DS363-E
          description: Charging key contract id
        visualNumber:
          type: string
          example: '6285629402937'
          description: Identifier printed on the physical key
        enabled:
          type: boolean
          example: true
          description: Charging key is enabled or disabled
        whitelist:
          $ref: '#/components/schemas/DriveApiChargingKeyWhitelistType'
          description: >-
            Defines whether the CPO may allow a session for this charging key
            when it cannot get a response from the EMP, or must always rely on
            realtime authorization from the EMP. Possible values:
            ALLOWED_OFFLINE, NEVER.
          example: NEVER
      description: EMP charging key details returned by key management endpoints.
    ErrorResponse:
      title: ErrorResponse
      type: object
      properties:
        message:
          type: string
    DriveApiChargingKeyWhitelistType:
      type: string
      enum:
        - ALLOWED_OFFLINE
        - NEVER
      description: >-
        Defines when authorization of a charging key by the CPO is allowed.

        ALLOWED_OFFLINE: CPO should use realtime authorization. But when the CPO
        cannot get a response from the eMSP, the CPO shall allow the charging
        key to be used.

        NEVER: Only realtime authorization is allowed. CPO shall always send a
        realtime authorization for any use of this charging key to the MSP.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````

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