> 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/guides/civilian.md).

# Civilian Requests

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

### Civilian Information

Now we are going to request an already existing civilians information, For this you will require an already create civilian character inside your guild, Let make the first request with a JSON Body.

## 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 |

{% tabs %}
{% tab title="200: OK Successful Request" %}

```javascript
{
    "guildID": "GUILD_ID",
    "userID": "USER_ID",
    "userName": "USER_NAME",
    "civilian": [],
    "citations": [],
    "fines": [],
    "arrests": [],
    "hospitalRecords": []
}
```

{% 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 %}
{% endtabs %}

### Deleting, Editing And Creating Civilians

With the API you can form almost anything that you can do with the normal version of RoleplayBot, Leaving it ideal for individual projects and different variations of RoleplayBot. If you have created something with RoleplayBot's API then please get in contact with us, We Would love to reward active developers!

## 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 %}

## 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 %}

## 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 %}

### Listing Civilians

To list and view the current amount of active civilians registered inside your guild using the following endpoint, The civilians array with provide an object per civilian. Run the request to get a better idea of the structure

## 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 %}

### Moving On

Now that you have the general idea of GET, POST, PATCH and DELETE requests its time to move on and expand your knowledge, We recommend checking out the endpoints section for a list of API Endpoints and methods.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/guides/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.
