# Create User

As a starting point, we need to create a new user on the Biometrid System. To do so, we need to make a request to the method Create User. This method only needs a parameter called ***reference\_id*** to be sent. This ***reference\_id*** refers to the user’s identifier on the client’s database. This way Biometrid solution won’t hold any sensitive information regarding the client’s final users. At the end of this creation process it will be returned a Biometrid Identifier to that user, that needs to be stored on the client’s side because it will be used on every process regarding user itself. If an error occurs, it's necessary to repeat this process until a successful response of the service.

### Registration Activity Diagram

![](https://2122220053-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LPVOStsHxb2tNPUTe6Q%2F-LP_d-e8lSLbbp78JxHN%2F-LP_dHRlz2UfxCNhUsC5%2FRegistration%20Activity.png?alt=media\&token=83e3cc5d-58b2-485f-b2eb-4b0dde08f273)

## Create User

<mark style="color:green;">`POST`</mark> `Https://api.biometrid.com/api/1.1/users`

This endpoint allows you to create an user

#### Query Parameters

| Name          | Type   | Description                                                                                    |
| ------------- | ------ | ---------------------------------------------------------------------------------------------- |
| mac\_address  | string | If set, this field associate a the created user with a device by mac\_address.                 |
| app\_token    | string | If using Firebase Notification Service, the app\_token provided should be used to create user. |
| reference\_id | string | Client's user identifier on client's database or just user's identifier                        |

#### Headers

| Name               | Type   | Description               |
| ------------------ | ------ | ------------------------- |
| x-biometrid-key    | string | Application client key.   |
| x-biometrid-secret | string | Application client secret |

{% tabs %}
{% tab title="200 User Created" %}
{% tabs %}
{% tab title="HTTP/1.1 200 OK" %}

```javascript
// new user created
{
    "status": true,
    "data": {
      "message": "NEW_USER_CREATED",
      "id": "59147e5afdda9b0ac0f5e31f"
    }
}

// user already associated with device
{
    "status": true,
    "data": {
      "message": "USER_ALREADY_ASSOCIATED_WITH_DEVICE",
      "id": "59147e5afdda9b0ac0f5e31f"
    }
}

```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="400 Missing Headers" %}
{% tabs %}
{% tab title="HTTP/1.1 400 Bad Request" %}

```javascript
{
    "status": false,
    "data": {
        "message": "AUTHENTICATION_HEADERS_MISSING"
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 Invalid Headers" %}
{% tabs %}
{% tab title="HTTP/1.1 401 Unauthorized" %}

```javascript
{
    "status": false,
    "data": {
        "message": "INVALID_AUTHENTICATION_HEADERS"
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="402 Request or User Limit Reached for Client Plan" %}
{% tabs %}
{% tab title="HTTP/1.1 402 Payment Required" %}

```javascript
//Request Limit Reached
    {
        "status": false,
        "data": {
            "message": "REQUEST_LIMIT_REACHED"
        }
    }
//User Limit Reached
    {
        "status": false,
        "data": {
            "message": "NOT_ALLOWED_TO_CREATE_USERS"
        }
    }
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="404 Client not found by given key" %}
{% tabs %}
{% tab title="HTTP/1.1 404 Not Found" %}

```javascript
{
    "status": false,
    "data": {
        "message": "CLIENT_NOT_FOUND/CHECK_AUTHENTICATION_HEADERS"
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="500 Error during user's creation on db." %}
{% tabs %}
{% tab title="HTTP/1.1 500 Internal Server Error" %}

```javascript
{
    "status": false,
    "data": {
        "message": "PROBLEM_OCURRED_REPEAT_REQUEST"
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

###
