> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.wisboo.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.wisboo.com/_mcp/server.

# Create user

POST https://api.wisboo.com/v1/stores/{store_id}/users
Content-Type: application/json

Crea un nuevo usuario en la tienda. El usuario se registra de inmediato sin enviar un email de confirmación.

**Campos requeridos:** `email`, `name`, `last_name`

Si ya existe una cuenta con el `email` indicado en la tienda, el request devuelve un error `422`.

Reference: https://docs.wisboo.com/wisboo-api/users/create-user

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `store_id` (string, required) — ID de tu tienda

### Headers

- `X-Idempotency-Key` (any, optional)

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional)
- `last_name` (string, optional)
- `email` (string, optional)
- `phone` (string, optional)
- `country` (string, optional) — País del usuario en el estándar ISO 3166 Alpha-2. Ej. AR (Argentina), (CL) Chile.
- `language` (enum, optional) — Idioma del usuario, por defecto se asigna el idioma de la cuenta.
  - Allowed values: `ES`, `PT`, `EN`
- `external_id` (string, optional) — ID del usuario en tu sistema.
- `avatar` (string, optional)
- `custom_fields` (V1StoresStoreIdUsersPostRequestBodyContentApplicationJsonSchemaCustomFields, optional) — Campos custom del usuario, estos corresponden a los definidos dentro de la tienda

## Response

### 201

Successful request

- `id` (string, optional)
- `name` (string, optional)
- `last_name` (string, optional)
- `email` (string, optional)
- `created_at` (datetime, optional)
- `country` (string, optional) — País del usuario en formato ISO-SO 3166-1 alpha-2
- `phone` (string, optional)
- `external_id` (string, optional)
- `language` (enum, optional)
  - Allowed values: `ES`, `PT`, `EN`
- `avatar` (string, optional)
- `custom_fields` (V1StoresStoreIdUsersPostResponsesContentApplicationJsonSchemaCustomFields, optional)

## Errors

### 400 Bad Request Error

Missing parameter

- `type` (string, optional)
- `code` (string, optional)
- `message` (string, optional)
- `details` (V1StoresStoreIdUsersPostResponsesContentApplicationJsonSchemaDetails, optional)
- `timestamp` (datetime, optional)
- `request_id` (string, optional)
- `log_id` (string, optional)

### 401 Unauthorized Error

Invalid access token

- `type` (string, optional)
- `code` (string, optional)
- `message` (string, optional)
- `timestamp` (datetime, optional)
- `request_id` (string, optional)
- `log_id` (string, optional)

### 422 Unprocessable Entity Error

Invalid email

- `type` (string, optional)
- `code` (string, optional)
- `message` (string, optional)
- `details` (list of V1StoresStoreIdUsersPostResponsesContentApplicationJsonSchemaDetailsItems, optional)
- `timestamp` (datetime, optional)
- `request_id` (string, optional)
- `log_id` (string, optional)

## Types

### V1StoresStoreIdUsersPostRequestBodyContentApplicationJsonSchemaCustomFields

Campos custom del usuario, estos corresponden a los definidos dentro de la tienda

### V1StoresStoreIdUsersPostResponsesContentApplicationJsonSchemaCustomFields

### V1StoresStoreIdUsersPostResponsesContentApplicationJsonSchemaDetails

- `field` (string, optional)
- `explanation` (string, optional)

### V1StoresStoreIdUsersPostResponsesContentApplicationJsonSchemaDetailsItems

- `field` (string, optional)
- `value` (string, optional)
- `explanation` (string, optional)

## Examples

**Request**

```json
{
  "name": "John",
  "last_name": "Doe",
  "email": "john_doe@example.com",
  "phone": "+5491134578457",
  "country": "AR",
  "language": "ES",
  "external_id": "1e3aafh",
  "custom_fields": {
    "field1": "value"
  },
  "password": "secret123"
}
```

**Response**

```json
{
  "id": "USR-06a8ddc702a570008a88f53d1bd8e16e",
  "name": "John",
  "last_name": "Doe",
  "email": "john_doe@email.com",
  "created_at": "2024-11-13T23:14:28.651Z",
  "country": "AR",
  "phone": "+5491134578457",
  "external_id": "1e3aafh",
  "language": "ES",
  "avatar": "",
  "custom_fields": {
    "field1": "value"
  },
  "role": "basic",
  "updated_at": "2024-11-13T23:14:28.665Z"
}
```

**SDK Code**

```python Users_createUser_example
import requests

url = "https://api.wisboo.com/v1/stores/:store_id/users"

payload = {
    "name": "John",
    "last_name": "Doe",
    "email": "john_doe@example.com",
    "phone": "+5491134578457",
    "country": "AR",
    "language": "ES",
    "external_id": "1e3aafh",
    "custom_fields": { "field1": "value" },
    "password": "secret123"
}
headers = {
    "X-Idempotency-Key": "936d2436-aa95-47ce-b0d9-3fcf7aae6558",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Users_createUser_example
const url = 'https://api.wisboo.com/v1/stores/:store_id/users';
const options = {
  method: 'POST',
  headers: {
    'X-Idempotency-Key': '936d2436-aa95-47ce-b0d9-3fcf7aae6558',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"John","last_name":"Doe","email":"john_doe@example.com","phone":"+5491134578457","country":"AR","language":"ES","external_id":"1e3aafh","custom_fields":{"field1":"value"},"password":"secret123"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Users_createUser_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.wisboo.com/v1/stores/:store_id/users"

	payload := strings.NewReader("{\n  \"name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"email\": \"john_doe@example.com\",\n  \"phone\": \"+5491134578457\",\n  \"country\": \"AR\",\n  \"language\": \"ES\",\n  \"external_id\": \"1e3aafh\",\n  \"custom_fields\": {\n    \"field1\": \"value\"\n  },\n  \"password\": \"secret123\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Idempotency-Key", "936d2436-aa95-47ce-b0d9-3fcf7aae6558")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Users_createUser_example
require 'uri'
require 'net/http'

url = URI("https://api.wisboo.com/v1/stores/:store_id/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '936d2436-aa95-47ce-b0d9-3fcf7aae6558'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"email\": \"john_doe@example.com\",\n  \"phone\": \"+5491134578457\",\n  \"country\": \"AR\",\n  \"language\": \"ES\",\n  \"external_id\": \"1e3aafh\",\n  \"custom_fields\": {\n    \"field1\": \"value\"\n  },\n  \"password\": \"secret123\"\n}"

response = http.request(request)
puts response.read_body
```

```java Users_createUser_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.wisboo.com/v1/stores/:store_id/users")
  .header("X-Idempotency-Key", "936d2436-aa95-47ce-b0d9-3fcf7aae6558")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"email\": \"john_doe@example.com\",\n  \"phone\": \"+5491134578457\",\n  \"country\": \"AR\",\n  \"language\": \"ES\",\n  \"external_id\": \"1e3aafh\",\n  \"custom_fields\": {\n    \"field1\": \"value\"\n  },\n  \"password\": \"secret123\"\n}")
  .asString();
```

```php Users_createUser_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.wisboo.com/v1/stores/:store_id/users', [
  'body' => '{
  "name": "John",
  "last_name": "Doe",
  "email": "john_doe@example.com",
  "phone": "+5491134578457",
  "country": "AR",
  "language": "ES",
  "external_id": "1e3aafh",
  "custom_fields": {
    "field1": "value"
  },
  "password": "secret123"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Idempotency-Key' => '936d2436-aa95-47ce-b0d9-3fcf7aae6558',
  ],
]);

echo $response->getBody();
```

```csharp Users_createUser_example
using RestSharp;

var client = new RestClient("https://api.wisboo.com/v1/stores/:store_id/users");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Idempotency-Key", "936d2436-aa95-47ce-b0d9-3fcf7aae6558");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"email\": \"john_doe@example.com\",\n  \"phone\": \"+5491134578457\",\n  \"country\": \"AR\",\n  \"language\": \"ES\",\n  \"external_id\": \"1e3aafh\",\n  \"custom_fields\": {\n    \"field1\": \"value\"\n  },\n  \"password\": \"secret123\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Users_createUser_example
import Foundation

let headers = [
  "X-Idempotency-Key": "936d2436-aa95-47ce-b0d9-3fcf7aae6558",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "John",
  "last_name": "Doe",
  "email": "john_doe@example.com",
  "phone": "+5491134578457",
  "country": "AR",
  "language": "ES",
  "external_id": "1e3aafh",
  "custom_fields": ["field1": "value"],
  "password": "secret123"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.wisboo.com/v1/stores/:store_id/users")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```