# Agregar usuario

Agregue nuevos miembros a su comercio. Utilice esta funcionalidad para incorporar usuarios con roles específicos o privilegios dentro de Trazo. Asegúrate de proporcionar la información necesaria sobre cada nuevo miembro para garantizar una integración fluida y segura de los nuevos usuarios en el sistema.

## &#x20;Ruta

<mark style="color:green;">`POST`</mark> `/v1/merchant/team`

## **Encabezado**

| Name                                                   | Value            |
| ------------------------------------------------------ | ---------------- |
| `Content-Type`*<mark style="color:red;">**\***</mark>* | application/json |
| `x-auth-token`*<mark style="color:red;">**\***</mark>* | {token}          |

## **Cuerpo**

<table><thead><tr><th width="210.59991455078125">Name</th><th width="137.33333333333331">Type<select><option value="HtQwVGPELqbz" label="string" color="blue"></option><option value="8XesFOeYVpGk" label="numeric" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td><code>phone</code></td><td><span data-option="HtQwVGPELqbz">string</span></td><td><p>Número de celular del usuario (incluir el código de área del país).  </p><p></p><p><em>Obligatorio en caso de que email se encuentre vacío.</em><br><br><em><mark style="color:blue;"><code>Ejemplo: 573112223333</code></mark></em></p></td></tr><tr><td><code>email</code></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Correo del usuario.<br><br><em>Obligatorio en caso de que phone se encuentre vacío.</em><br><br><em><mark style="color:blue;"><code>Ejemplo: cliente@minegocio.com</code></mark></em></td></tr><tr><td><code>nickname</code></td><td><span data-option="HtQwVGPELqbz">string</span></td><td><p>Es el nombre con el que nos comunicaremos con el usuario, por ejemplo <em><strong>¡Hola Carlos!</strong></em></p><p><br>Por defecto es el mismo first_name.</p><p><br><em><mark style="color:blue;"><code>Ejemplo: Carlos</code></mark></em></p></td></tr><tr><td><code>first_name</code><em><mark style="color:red;"><strong>*</strong></mark></em></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Nombres del usuario. Se usan para la validación del número de documento.<br><br><em><mark style="color:blue;"><code>Ejemplo: Carlos Andrés</code></mark></em></td></tr><tr><td><code>last_name</code></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Son los apellidos del usuario.<br><br><em><mark style="color:blue;"><code>Ejemplo: Martínez Barrios</code></mark></em></td></tr><tr><td><code>user_id_type</code><em><mark style="color:red;"><strong>*</strong></mark></em></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Tipo de documento de identificación del usuario.<br><br><mark style="color:green;"><code>CC | CE | NIT | PASAPORTE | DNI | EIN</code></mark></td></tr><tr><td><code>user_id_number</code><em><mark style="color:red;"><strong>*</strong></mark></em></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Número del documento de identificación del usuario.<br><br><em><mark style="color:blue;"><code>Ejemplo: 11119999</code></mark></em></td></tr><tr><td><code>user_id_number_dv</code></td><td><span data-option="HtQwVGPELqbz">string</span></td><td><p>Dígito de verificación del número de identificación del usuario.</p><p></p><p><em><strong>Aplica únicamente para NIT.</strong></em><br><br><em><mark style="color:blue;"><code>Ejemplo: 9</code></mark></em></p></td></tr><tr><td><code>role</code><em><mark style="color:red;"><strong>*</strong></mark></em></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Define el rol que tendrá el usuario dentro de Trazo.<br><br><mark style="color:green;"><code>collector | member | analyst | specialist</code></mark></td></tr><tr><td><code>collect_limit</code></td><td><span data-option="8XesFOeYVpGk">numeric</span></td><td>Valor máximo autorizado para recaudar por el usuario en efectivo.<br><br><em><mark style="color:blue;"><code>Ejemplo: 2000000</code></mark></em></td></tr><tr><td><code>external_user_id</code></td><td><span data-option="HtQwVGPELqbz">string</span></td><td>Identificador asignado para el usuario.<br><br><em><mark style="color:blue;"><code>Ejemplo: KFF122</code></mark></em></td></tr></tbody></table>

## **Respuesta**

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

```json
{
    "message": "The user has been successfully created.",
    "created_at": "2024-08-27T13:48:50+00:00"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "error": "The provided phone number is not valid or already registered in the system."
}
```

{% endtab %}

{% tab title="401" %}

```bash
{
    "status": "unauthorized",
    "code": "Q103",
    "error": "El x-auth-token se encuentra vencido. Por favor genera un nuevo token y reintenta de nuevo el cobro."
}
```

{% endtab %}
{% endtabs %}

***

## &#x20;Ejemplo

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

```bash
curl --location --request POST '{{base_url}}/v1/merchant/team' \
--header 'x-auth-token: {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "phone": "",
    "email": "",
    "nickname": "",
    "first_name": "",
    "last_name": "",
    "user_id_type": "",
    "user_id_number": "",
    "user_id_number_dv": "",
    "role": "",
    "collect_limit": "",
    "user_country": "",
    "user_state": "",
    "user_city": ""
}'
```

{% endtab %}

{% tab title="NodeJS (Axios)" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "phone": "",
  "email": "",
  "nickname": "",
  "first_name": "",
  "last_name": "",
  "user_id_type": "",
  "user_id_number": "",
  "user_id_number_dv": "",
  "role": "",
  "collect_limit": "",
  "user_country": "",
  "user_state": "",
  "user_city": ""
});

var config = {
  method: 'post',
  url: `${base_url}/v1/merchant/team`,
  headers: { 
    'x-auth-token': token, //Agregar token
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = f"{base_url}/v1/merchant/team"

payload = json.dumps({
  "phone": "",
  "email": "",
  "nickname": "",
  "first_name": "",
  "last_name": "",
  "user_id_type": "",
  "user_id_number": "",
  "user_id_number_dv": "",
  "role": "",
  "collect_limit": "",
  "user_country": "",
  "user_state": "",
  "user_city": ""
})
headers = {
  'x-auth-token': token, #Agregar token
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)
```

{% 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.qentaz.com/documentation/equipo/agregar-usuario.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.
