# Custom Attributes

{% hint style="info" %}
Each plan comes with a specific number of custom attributes per user - using more than the specified amount will return 507.
{% endhint %}

## Get Custom Attributes

<mark style="color:blue;">`GET`</mark> `https://docs.accountable.pixelninja.dev/<token>/user/<uuid>/data`

Get all custom attributes relating to a user. You can use this 3 times per second.

#### Path Parameters

| Name  | Type   | Description                                                             |
| ----- | ------ | ----------------------------------------------------------------------- |
| token | string | This is your API token.                                                 |
| uuid  | string | This is the UUID of the user whose custom attributes you want to fetch. |

{% tabs %}
{% tab title="200 Successfully retrieved the user's custom attributes." %}

```c
{ "email": "a@a.co", "region": "Europe" }
```

{% endtab %}

{% tab title="400 Your token was incorrect." %}

```c
{ "code": 400, "message": "Bad request" }
```

{% endtab %}
{% endtabs %}

## Create Custom Attributes

<mark style="color:green;">`POST`</mark> `https://accountable.pixelninja.dev/:token/user/:uuid/data`

Create custom attributes for a specified user. You can do this in bulk as the request body takes a 2d array. This endpoint can be used 2 times per second.

#### Path Parameters

| Name  | Type   | Description                                           |
| ----- | ------ | ----------------------------------------------------- |
| token | string | This is your API token.                               |
| uuid  | string | The UUID of the user who is getting the values added. |

#### Request Body

| Name | Type  | Description                               |
| ---- | ----- | ----------------------------------------- |
| data | array | 2d array of the custom attributes to add. |

{% tabs %}
{% tab title="201 The attributes provided have been created successfully" %}

```c
{ "code": 201, "message": "Created" }
```

{% endtab %}

{% tab title="400 An incorrect API token was provided or the format of the custom attributes was incorrect." %}

```c
{ "code": 400, "message": "Bad request" }
```

{% endtab %}

{% tab title="507 You cannot add any more custom attributes to this user. Upgrade your plan and try again " %}

```c
{ "code": 507, "message": "Out of storage" }
```

{% endtab %}
{% endtabs %}

The 2d array should be formatted as followed:

```c
[["key 1", "value 1"], ["key 2", "value 2"], ["key 3", "value 3"]]
```

## Delete Custom Attribute

<mark style="color:red;">`DELETE`</mark> `https://accountable.pixelninja.dev/:token/user/:uuid/data/:key`

This will delete the specified key and its corresponding value. This cannot be undone. You can use this endpoint 2 times per second.

#### Path Parameters

| Name  | Type   | Description                                                        |
| ----- | ------ | ------------------------------------------------------------------ |
| Token | string | This is your API token.                                            |
| UUID  | string | The UUID of who has the custom attribute you are trying to delete. |
| Key   | string | The custom attribute name you want to delete.                      |

{% tabs %}
{% tab title="204 " %}

```c
{ "code": 204, "message": "No content" }
```

{% endtab %}

{% tab title="400 An invalid token was provided, or the key you are trying to delete is invalid. " %}

```c
{ "code": 400, "message": "Bad request" }
```

{% endtab %}
{% endtabs %}
