# Civilian Endpoints

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

### Civilian Endpoints

Raw list of civilian endpoints:

* GET /civilian/info
* GET /civilian/list
* POST /civilian/create
* PATCH /civilian/edit
* PATCH /civilian/bolo
* PATCH /civilian/deceased
* DELETE /civilian/delete

List of civilian endpoint methods

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

```javascript
{            
   deceased: "DECEASED",
   bolo: "BOLO",
   boloReason: "REASON",
   civilianAge: "AGE",
   civilianDOB: "DOB",
   civilianGender: "GENDER",
   civilianHairColor: "HAIR COLOR",
   civilianHeight: "HEIGHT",
   civilianWeight: "WEIGHT",
   civilianAddress: "ADDRESS",
   civilianOccupation: "OCCUPATION",
   registrationTimestamp: "TIMESTAMP",
}
```

{% endtab %}
{% endtabs %}

## Civilian Information

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

Returns a civilians 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                       |
| -------------------------------------- | --------- | --------------------------------- |
| name<mark style="color:red;">\*</mark> | CIV\_NAME | Civilian Characters Name (String) |

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

```javascript
{
    "guildID": "GUILD_ID",
    "userID": "USER_ID",
    "userName": "USER_NAME",
    "civilian": [],
    "citations": [
        {
            "officerName": "OFFICER_NAME",
            "officerID": "OFFICER_ID",
            "amount": "AMOUNT",
            "charges": "CHARGES",
            "timestamp": "TIMESTAMP"
        }
    ],
    "fines": [
        {
            "officerName": "OFFICER_NAME",
            "officerID": "OFFICER_ID",
            "amount": "AMOUNT",
            "charges": "CHARGES",
            "timestamp": "TIMESTAMP"
        }
    ],
    "arrests": [
        {
            "officerName": "OFFICER_NAME",
            "officerID": "OFFICER_ID",
            "time": "TIME",
            "charges": "CHARGES",
            "timestamp": "TIMESTAMP"
        }
    ],
    "hospitalRecords": [
        {
            "medicName": "MEDIC_NAME",
            "medicID": "MEDIC_ID",
            "injures": "INJURES",
            "time": "TIME",
            "timestamp": "TIMESTAMP"
        }
    ]
}
```

{% 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 Civilian Not found" %}
Civilian character could not be found

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

{% endtab %}
{% endtabs %}

## List Civilians

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

Provides an array with objects per active civilian characters, also returns a value specifying the current amount of civilians

#### 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 Civilians Found" %}
One or more civilians found and listed

```javascript
{
    amount: "CIV_AMOUNT",
    guildID: "GUILD_ID",
    civilians: []
}
```

{% endtab %}

{% tab title="404: Not Found No Civilians Found" %}
There is no registered civilian characters inside the guild

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

{% endtab %}
{% endtabs %}

## Create Civilian

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

Creates a civilian character with supplied parameters

#### 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                                    |
| -------------------------------------------- | --------------- | ---------------------------------------------- |
| userID<mark style="color:red;">\*</mark>     | USER\_ID        | Creating Users ID (String)                     |
| userName<mark style="color:red;">\*</mark>   | USER\_NAME      | Creating Users Name (String)                   |
| name<mark style="color:red;">\*</mark>       | CIV\_NAME       | Civilian Name (String) (<100 Characters)       |
| age<mark style="color:red;">\*</mark>        | CIV\_AGE        | Civilian Age (Number) (<100)                   |
| dob<mark style="color:red;">\*</mark>        | CIV\_DOB        | Civilian Date Of Birth (String)                |
| gender<mark style="color:red;">\*</mark>     | CIV\_GENDER     | Civilian Gender (Takes: Male, Female Or Other) |
| hair<mark style="color:red;">\*</mark>       | CIV\_HAIR       | Civilian Hair Color (String)                   |
| weight<mark style="color:red;">\*</mark>     | CIV\_WEIGHT     | Civilian Weight in KG (Number) (<500)          |
| height<mark style="color:red;">\*</mark>     | CIV\_HEIGHT     | Civilian Height in CM (Number) (<500)          |
| address<mark style="color:red;">\*</mark>    | CIV\_ADDRESS    | Civilian Address (String)                      |
| occupation<mark style="color:red;">\*</mark> | CIV\_OCCUPATION | Civilian Occupation (String)                   |

{% 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 Civilian name already exists" %}
A civilian with that specified name already existing inside your guild

```javascript
{
    error: "400 Bad request",
    details: "Civilian character already exists (10020)"
}
```

{% endtab %}

{% tab title="201: Created Created civilian" %}

```javascript
{
    guildID: "GUILD_ID",
    civilianID: "CIV_ID",
    civilianName: "CIV_NAME",
    userName: "USER_NAME",
    userID: "USER_ID",
    success: "Successfully created civilian",
    civilian: []
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Edit Civilian

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

Edits a civilian character with the specified field and value\
Valid Fields:\
\- hair color (Value: String)\
\- name (Value: String)\
\- age (Value: Number <100)\
\- dob (Value: String)\
\- height (Value: Number <500)\
\- weight (Value: Number <500)\
\- occupation (Value: String)\
\- address (Value: String)

#### 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="202: Accepted Value doesn't differ" %}
Setting value is the same as the current value

```javascript
{
    error: 'Character <FIELD> is already <VALUE> (<ERR_CODE>)'
}
```

{% endtab %}

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

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

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Civilian BOLO

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

Call to activate or deactivate a BOLO

#### 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)                          |
| bolo<mark style="color:red;">\*</mark> | BOLO      | Set BOLO (Boolean) (\*True = Activate BOLO)     |
| reason                                 | REASON    | BOLO Reason (Required when bolo is set to true) |

{% 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="404: Not Found Civilian Not Found" %}
Requested civilian character cannot be found

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

{% endtab %}

{% tab title="202: Accepted BOLO Already Active/inactive" %}
Civilian has an active BOLO

<pre class="language-javascript"><code class="lang-javascript">{
    guildID: "GUILD",
    userName: "USER_NAME",
<strong>    userID: "USER_ID",
</strong>    civilianName: "CIV_NAME",
<strong>    civilianID: "CIV_ID",
</strong>    error: 'BOLO is already (active/incative)',
    civilian: []
}
</code></pre>

{% endtab %}

{% tab title="201: Created BOLO Set Active/inactive" %}
Civilian doesn't have an active BOLO

```javascript
{
    guildID: "GUILD",
    userName: "USER_NAME",
    userID: "USER_ID",
    civilianName: "CIV_NAME",
    civilianID: "CIV_ID",
    success: 'BOLO set (active/inactive)',
    civilian: []
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are missing/incorrect" %}
The bolo or reason field is missing or invalid (Incorrect Type)

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

{% endtab %}
{% endtabs %}

## Civilian Deceased

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

Sets a civilian deceased.\
WARNING: This action is irreversible, Once a civilian is set deceased it can no longer be used.&#x20;

#### 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)                              |
| deceased<mark style="color:red;">\*</mark> | DECEASED  | Deceased Value (True Boolean) (True = Set Deceased) |

{% tabs %}
{% tab title="202: Accepted Civilian Already Deceased" %}

```javascript
{
    guildID: "GUILD",
    civilianName: "CIV_NAME",
    civilianID: "CIV_ID",
    userName: "USER_NAME",
    userID: "USER_ID",
    deceased: "DECEASED",
    error: 'Character is already marked deceased'
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}
The deceased field is missing or invalid (Incorrect Type)

```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="201: Created Civilian Marked Deceased" %}
Civilian has been marked deceased

```javascript
{
    guildID: "GUILD_ID",
    civilianName: "CIV_NAME",
    civilianID: "CIV_ID",
    userName: "USER_NAME",
    userID: "USER_ID",
    success: 'Marked deceased',
    civilian: []
}
```

{% endtab %}
{% endtabs %}

## Delete Civilian

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

Deletes 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) |

{% tabs %}
{% tab title="200: OK Civilian Deleted" %}
Successfully deleted civilian

```javascript
{
    guildID: "GUILD_ID",
    civilianID: "CIV_ID",
    civilianName: "CIV_NAME",
    userName: "USER_NAME",
    userID: "USER_ID",
    success: "Deleted civilian",
    civilian: []
}
```

{% 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 civilian" %}
Database error, Unable to delete civilian character inside database. Contact RoleplayBot support

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

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roleplaybot.xyz/api/endpoints/civilian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
