---
title: "Assign a key fob to a driver."
url: "https://developers.vzconnect.com/apis/driver-api/versions/dd59d93e-671c-494a-b1e2-63fbd7c9d7da/operations/assignDriverKey"
---

> Full API specification: https://developers.vzconnect.com/apis/driver-api/versions/dd59d93e-671c-494a-b1e2-63fbd7c9d7da.md

# Assign a key fob to a driver.

`POST` `/cmd/v1/drivers/{drivernumber}/keys`

Operation ID: `assignDriverKey`

Assign key fobs to the driver record. The key fob(s) are entered as part of the body of the request.

## Path parameters

- `drivernumber` (string, required) - The Driver Number to assign key fobs to.

## Request body (required)

Content types: `application/json`

## Responses

- `201` - Key fob successfully assigned to the driver.
- `400` - Bad request. The request body is invalid or the key fob is already assigned.
- `401` - Unauthorized. Authentication credentials are missing or invalid.
- `500` - Internal server error.

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Driver API
  version: "1.0"
servers:
  - url: https://api.us.vzconnect.com
paths:
  /cmd/v1/drivers/{drivernumber}/keys:
    post:
      summary: Assign a key fob to a driver.
      description: Assign key fobs to the driver record. The key fob(s) are entered as
        part of the body of the request.
      operationId: assignDriverKey
      tags:
        - Driver API
      parameters:
        - name: drivernumber
          in: path
          required: true
          description: The Driver Number to assign key fobs to.
          schema:
            type: string
      requestBody:
        description: Key fob assignment details including the key fob identifier.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KeyFobList"
            example:
              - "23456789"
        required: true
      responses:
        "201":
          description: Key fob successfully assigned to the driver.
          headers:
            Location:
              description: URL of the driver's key fob resource.
              schema:
                type: string
                example: https://vzc.local/drivers/100096/keys
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KeyFobList"
              example:
                - "23456789"
        "400":
          description: Bad request. The request body is invalid or the key fob is already
            assigned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized. Authentication credentials are missing or invalid.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    KeyFobList:
      type: array
      description: A list of key fob identifiers. Each id is a hexadecimal string of
        8, 12 or 16 characters (12 and 16 character forms are reduced to 8).
        Returned ids are uppercase hexadecimal.
      items:
        type: string
        example: "23456789"
      example:
        - "23456789"
    Error:
      type: object
      description: Generic error response. The documentation does not define an
        explicit error body schema.
      properties:
        message:
          type: string
          description: A human-readable description of the error.
```
