---
updatedAt: 2026-07-02T10:57:17.000Z
agentTools:
  projectIndex: https://developer.2hire.io/llms.txt
---

# Register a vehicle

Register a vehicle in the system in order to interact with it

<br />

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "version": "1.0.0",
    "title": "2hireAsAdapter API - Prod",
    "description": "2hireAsAdapter API lets you manage and control one vehicle and a thousand vehicle alike.",
    "contact": {
      "name": "2hire",
      "email": "info@2hire.io",
      "url": "https://2hire.io"
    }
  },
  "servers": [
    {
      "url": "https://adapter.2hire.io"
    }
  ],
  "tags": [
    {
      "name": "Vehicle Registration",
      "description": "Register a vehicle in the system"
    }
  ],
  "paths": {
    "/api/v1/vehicle/register": {
      "post": {
        "security": [
          {
            "Bearer": []
          }
        ],
        "tags": [
          "Vehicle Registration"
        ],
        "summary": "Register a vehicle",
        "operationId": "registerVehicle",
        "description": "Register a vehicle in the system in order to interact with it",
        "parameters": [
          {
            "name": "x-user",
            "in": "header",
            "description": "User identifier",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-application",
            "in": "header",
            "description": "Application identifier",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/NiuRegistrationSchema"
                  },
                  {
                    "$ref": "#/components/schemas/OmniNinebotRegistrationSchema"
                  },
                  {
                    "$ref": "#/components/schemas/OkaiRegistrationSchema"
                  }
                ],
                "discriminator": {
                  "propertyName": "oem",
                  "mapping": {
                    "niu": "#/components/schemas/NiuRegistrationSchema",
                    "omni_ninebot": "#/components/OmniNinebotRegistrationSchema",
                    "okai": "#/components/schemas/OkaiRegistrationSchema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SuccessRegistrationResponse"
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/AuthenticationError"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationErrorRegisterResponse"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "responses": {
      "SuccessRegistrationResponse": {
        "description": "Success Registration Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SuccessRegistrationResponse"
            },
            "examples": {
              "success response": {
                "summary": "Success Response",
                "value": {
                  "vehicleId": "54234990-c9e7-4057-8172-0c3a6f06a0e3"
                }
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InternalError"
            },
            "examples": {
              "Internal Error": {
                "value": {
                  "code": "INTERNAL_ERROR",
                  "details": {
                    "cause": "INTERNAL_ERROR"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      },
      "BadRequestError": {
        "description": "Bad Request Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BadRequestError"
            },
            "examples": {
              "Bad Format": {
                "summary": "Bad Format Error",
                "value": {
                  "code": "BAD_REQUEST_ERROR",
                  "details": {
                    "cause": "BAD_FORMAT"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      },
      "AuthenticationError": {
        "description": "Authentication Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuthenticationError"
            },
            "examples": {
              "Token expired": {
                "summary": "Token Expired",
                "value": {
                  "code": "AUTHENTICATION_ERROR",
                  "details": {
                    "cause": "TOKEN_EXPIRED"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      },
      "AuthorizationErrorRegisterResponse": {
        "description": "Authorization and Vehicle Registration Errors Responses",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/VehicleRegistrationError"
                },
                {
                  "$ref": "#/components/schemas/AuthorizationError"
                }
              ]
            },
            "examples": {
              "Vehicle Registration Error": {
                "value": {
                  "code": "VEHICLE_REGISTRATION_ERROR",
                  "details": {
                    "cause": "VEHICLE_ALREADY_REGISTERED"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              },
              "Authorization Error": {
                "value": {
                  "code": "AUTHORIZATION_ERROR",
                  "cause": "INSUFFICIENT_PERMISSIONS",
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "SuccessRegistrationResponse": {
        "type": "object",
        "properties": {
          "vehicleId": {
            "type": "string",
            "description": "Identifier of the vehicle generated by 2hire"
          }
        }
      },
      "InternalErrorCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INTERNAL_ERROR"
            ]
          }
        }
      },
      "QRCodeNotFoundCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "QR_CODE_NOT_FOUND"
            ]
          }
        }
      },
      "InternalError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "INTERNAL_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/components/schemas/InternalErrorCause"
              },
              {
                "$ref": "#/components/schemas/QRCodeNotFoundCause"
              }
            ]
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "BadRequestCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "BAD_REQUEST"
            ]
          }
        }
      },
      "InvalidUUIDCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INVALID_UUID"
            ]
          }
        }
      },
      "InvalidSignalNameCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INVALID_SIGNAL_NAME"
            ]
          }
        }
      },
      "BadFormatCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "BAD_FORMAT"
            ]
          }
        }
      },
      "BadRequestError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "BAD_REQUEST_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/components/schemas/BadRequestCause"
              },
              {
                "$ref": "#/components/schemas/InvalidUUIDCause"
              },
              {
                "$ref": "#/components/schemas/InvalidSignalNameCause"
              },
              {
                "$ref": "#/components/schemas/BadFormatCause"
              }
            ]
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "AuthorizationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "AUTHORIZATION_ERROR"
            ]
          },
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INSUFFICIENT_PERMISSIONS",
              "UNKNOWN"
            ]
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "AuthenticationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "AUTHENTICATION_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "properties": {
              "cause": {
                "type": "string",
                "description": "Specific cause of the error",
                "enum": [
                  "HEADER_MALFORMED",
                  "HEADER_MISSING",
                  "TOKEN_AUDIENCE_NOT_ALLOWED",
                  "TOKEN_CREATION_FAILED",
                  "TOKEN_EXPIRED",
                  "TOKEN_KEY_ERROR",
                  "TOKEN_SIGN_ERROR",
                  "TOKEN_VERIFICATION_FAILED",
                  "GET_THIRD_PARTY_TOKEN_FAILED"
                ]
              }
            }
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "VehicleRegistrationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "VEHICLE_REGISTRATION_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "properties": {
              "cause": {
                "type": "string",
                "description": "Specific cause of the error",
                "enum": [
                  "VEHICLE_ALREADY_REGISTERED"
                ]
              }
            }
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "NiuRegistrationSchema": {
        "type": "object",
        "title": "Niu",
        "properties": {
          "oem": {
            "type": "string",
            "description": "Vehicle Manufacturer",
            "enum": [
              "niu"
            ]
          },
          "data": {
            "type": "object",
            "properties": {
              "deviceSn": {
                "type": "string",
                "description": "NIU identifier of the vehicle"
              },
              "companyId": {
                "type": "string",
                "description": "NIU company id of the vehicle"
              },
              "companySecret": {
                "type": "string",
                "description": "NIU company secret of the vehicle"
              }
            },
            "required": [
              "deviceSn",
              "companyId",
              "companySecret"
            ]
          }
        }
      },
      "OkaiRegistrationSchema": {
        "type": "object",
        "title": "Okai",
        "properties": {
          "oem": {
            "type": "string",
            "description": "Vehicle Manufacturer",
            "enum": [
              "okai"
            ]
          },
          "data": {
            "type": "object",
            "properties": {
              "imei": {
                "type": "string",
                "description": "Okai identifier of the vehicle"
              }
            }
          }
        }
      },
      "OmniNinebotRegistrationSchema": {
        "type": "object",
        "title": "Ninebot + Omni",
        "description": "Ninebot scooters with Omni IoT",
        "properties": {
          "oem": {
            "type": "string",
            "description": "Vehicle Manufacturer",
            "enum": [
              "omni_ninebot"
            ]
          },
          "data": {
            "type": "object",
            "properties": {
              "imei": {
                "type": "string",
                "description": "Omni Ninebot identifier of the vehicle"
              }
            },
            "required": [
              "imei"
            ]
          }
        }
      }
    }
  }
}
```