> For the complete documentation index, see [llms.txt](https://docs.roleplaybot.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roleplaybot.xyz/api/endpoints/vehicle.md).

# Vehicle Endpoints

{% hint style="danger" %}
The API has been deprecated and is no longer in use.
{% endhint %}

### Vehicle Endpoints

Raw list of vehicle endpoints:

* GET /vehicle/plate
* GET /vehicle/list
* POST /vehicle/create
* PATCH /vehicle/edit
* DELETE /vehicle/delete

List of vehicle endpoint methods

{% tabs %}
{% tab title="Vehicle Array Structure" %}
If you see the empty "vehicle" array or `vehicle: []`  This is simply just the placeholder for the vehicle object structure, Which looks like this in all major requests: (Inside the array)

```javascript
{            
   id: "ID",
   userID: "USER_ID",
   userName: "USER_NAME",
   civilianID: "CIV_ID",
   civilianName: "CIV_NAME",
   impounded: "IMPOUNDED",
   stolen: "STOLEN",
   plate: "PLATE",
   model: "MODEL",
   registration: "REGISTRATION",
   insurance: "INSURANCE",
   color: "COLOR",
   colorType: "COLOR_TYPE",
   timestamp: "TIMESTAMP",
}
```

{% endtab %}
{% endtabs %}

## Vehicle Search

<mark style="color:blue;">`GET`</mark> `https://roleplaybot.xyz/api/vehicle/plate`

Searches a civilian plate and returns the information

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                    | Type  | Description            |
| --------------------------------------- | ----- | ---------------------- |
| plate<mark style="color:red;">\*</mark> | PLATE | Vehicle Plate (String) |

{% tabs %}
{% tab title="200: OK Vehicle Found" %}
Citations, Fine, Arrests and Hospital Record arrays provide an object per action.

```javascript
{
    found: true,
    guildID: "GUILD_ID",
    vehicle: []
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}
Invalid or missing field

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="404: Not Found Vehicle not found" %}

```javascript
{
    found: false,
    error: "404 Not found",
    details: "Vehicle not found (10023)"
}
```

{% endtab %}
{% endtabs %}

## List Vehicles

<mark style="color:blue;">`GET`</mark> `https://roleplaybot.xyz/api/vehicle/list`

Provides every registered vehicle inside the guild

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

{% tabs %}
{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="200: OK Vehicles Found" %}
One or more vehicles found and listed

```javascript
{
    amount: "VEHICLE_AMOUNT",
    guildID: "GUILD_ID",
    vehicles: []
}
```

{% endtab %}

{% tab title="404: Not Found No Vehicles Found" %}
There is no registered vehicles inside the guild

```javascript
{
    error: "404 Not found",
    details: "Unable to find any vehicles (20060)"
}
```

{% endtab %}
{% endtabs %}

## Create Vehicle

<mark style="color:green;">`POST`</mark> `https://roleplaybot.xyz/api/vehicle/create`

Registers a vehicle to a civilian character

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                           | Type         | Description                                                              |
| ---------------------------------------------- | ------------ | ------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark>         | CIV\_NAME    | Civilian Name (String)                                                   |
| plate<mark style="color:red;">\*</mark>        | PLATE        | Vehicle Plate (String)                                                   |
| model<mark style="color:red;">\*</mark>        | MODEL        | Vehicle Model (String)                                                   |
| color<mark style="color:red;">\*</mark>        | COLOR        | Vehicle Color (String)                                                   |
| colorType<mark style="color:red;">\*</mark>    | COLOR\_TYPE  | Vehicle color type (Takes: Classic, Metallic, Matte, Metal, Pearlescent) |
| registration<mark style="color:red;">\*</mark> | REGISTRATION | Vehicle registration (Takes: Valid, Expired)                             |
| insurance<mark style="color:red;">\*</mark>    | INSURANCE    | Vehicle insurance (Takes: Valid, Expired, None)                          |

{% tabs %}
{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}
Invalid or missing field

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="400: Bad Request Vehicle plate already exists" %}
A vehicle with that specified plate already existing inside your guild

```javascript
{
    error: "400 Bad request",
    details: "Registered vehicle plate already exists (10020)"
}
```

{% endtab %}

{% tab title="201: Created Registered Vehicle" %}
Registered vehicle

```javascript
{
    guildID: "GUILD_ID",
    plate: "PLATE",
    civilianName: "CIV_NAME",
    civilianID: "CIV_ID",
    success: "Registered vehicle",
    vehicle: []
}
```

{% endtab %}

{% tab title="500: Internal Server Error Unable to register vehicle" %}
Database error, Unable to register vehicle inside database. Contact RoleplayBot support

```javascript
{
    error: "500 Internal server error",
    details: "Unable to execute request (10022)"
}
```

{% endtab %}
{% endtabs %}

## Edit Vehicle

<mark style="color:purple;">`PATCH`</mark> `https://roleplaybot.xyz/api/vehicle/edit`

Edits a vehicle with the specified field and value\
Valid Fields:\
\- color (Value: String)\
\- insurance (Takes: Valid, Expired, None)\
\- registration (Takes: Valid, Expired)\
\- stole (Value: Boolean)

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                    | Type      | Description                                    |
| --------------------------------------- | --------- | ---------------------------------------------- |
| name<mark style="color:red;">\*</mark>  | CIV\_NAME | Civilian Name (String)                         |
| field<mark style="color:red;">\*</mark> | FIELD     | Field to edit (Must be listed in valid fields) |
| value<mark style="color:red;">\*</mark> | VALUE     | Value to set (Must match allocated field)      |

{% tabs %}
{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="201: Created Vehicle Edited" %}
Vehicle successfully edited

```javascript
{
    guildID: "GUILD_ID",
    civilianName: "CIV_NAME",
    civilianID: "CIV_ID",
    userID: "USER_ID",
    userName: "USER_NAME",
    plate: "PLATE",
    field: "FIELD",
    value: "VALUE",
    oldValue: "OLD_VALUE",
    success: 'Field updated',
    vehicle: []
}
```

{% endtab %}

{% tab title="500: Internal Server Error Unable to edit vehicle" %}
Database error, Unable to edit vehicle inside database. Contact RoleplayBot support

```javascript
{
    error: "500 Internal server error",
    details: "Unable to execute request (10021)"
}
```

{% endtab %}
{% endtabs %}

## Delete Vehicle

<mark style="color:red;">`DELETE`</mark> `https://roleplaybot.xyz/api/vehicle/delete`

Deletes a vehicle using the vehicle ID

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                        | Type        | Description         |
| ------------------------------------------- | ----------- | ------------------- |
| vehicleID<mark style="color:red;">\*</mark> | VEHICLE\_ID | Vehicle ID (String) |

{% tabs %}
{% tab title="200: OK Vehicle Deleted" %}
Successfully deleted vehicle

```javascript
{
    guildID: "GUILD_ID",
    id: "VEHICLE_ID",
    success: 'Deleted registered vehicle'
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Unable to delete vehicle" %}
Database error, Unable to delete vehicle inside database. Contact RoleplayBot support

```javascript
{
    error: "500 Internal server error",
    details: "Unable to execute request (10021)"
}
```

{% endtab %}
{% endtabs %}
