> For the complete documentation index, see [llms.txt](https://user.netmera.com/netmera-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/users/register-users.md). Agents can also search and read this documentation through its [MCP server](https://user.netmera.com/netmera-developer-guide/~gitbook/mcp).

# Register Users

Registers users and their devices from your backend, or updates existing ones. Each array entry is one registration: a device with its push token and platform, or an SMS-only user with an MSISDN.

#### How it works

1. Netmera validates the whole request, then processes the registrations asynchronously.
2. Each registration is matched to an existing user by `extId`. If none matches, a new user is created.
3. Optional tags and profile attributes in the entry are applied to the user: profile values are merged into the existing profile and tags are added.

<details>

<summary>Notes</summary>

* If any entry is invalid, the whole request is rejected with HTTP 400 and no entry is registered, valid ones included.
* An entry is invalid when it has neither `platform` nor `msisdn`, an unknown `platform`, `tags` that is not an array, or an unreadable `profile` block.
* An empty array is rejected with code `2020`.
* A body that is a single object instead of an array returns HTTP 400, code `2001`, "An unexpected error occurred. Retry later.".
* If the `deviceToken` already belongs to a device, that device moves to this user. An anonymous owner simply receives the `extId`.
* If that device's owner has a different `extId`, the owner is not changed and a new user is created instead.
* Without a `deviceToken`, every call creates a new device, except for EMAIL and SMS platforms, which get no device.
* An email address or phone number held by another user moves to this user.
* A previously deleted user is restored.

</details>

```json
{"openapi":"3.1.0","info":{"title":"Netmera REST API","version":"3.0"},"tags":[{"name":"Users","description":"Create or update users in Netmera from your own system, and remove them. A user is identified by\nyour external ID (`extId`).\n\n<table data-view=\"cards\"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type=\"content-ref\"></th></tr></thead><tbody><tr><td><strong>Register Users</strong></td><td><code>POST</code> Registers users and their devices from your backend, or updates existing ones.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/users/register-users\">Register Users</a></td></tr><tr><td><strong>Delete Users</strong></td><td><code>POST</code> Marks users as untracked, so they are no longer targeted by campaigns.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/users/delete-users\">Delete Users</a></td></tr><tr><td><strong>Delete Users Permanently</strong></td><td><code>POST</code> Permanently deletes all data of the given users from Netmera, including their devices, profile attributes, events and records.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/users/delete-users-permanently\">Delete Users Permanently</a></td></tr></tbody></table>\n"}],"servers":[{"url":"https://restapi.netmera.com","description":"Netmera REST API"}],"security":[{"REST-API-key":[]}],"components":{"securitySchemes":{"REST-API-key":{"type":"apiKey","in":"header","name":"X-netmera-api-key","description":"REST API key. Available in the Netmera Panel under Developers > API.\n"}},"schemas":{"NetmeraError":{"type":"object","description":"Standard Netmera error body.","required":["code","error"],"properties":{"code":{"type":"integer","description":"Netmera error code. See the error table in the API description."},"error":{"type":"string","description":"Human readable error message."}}}},"responses":{"InvalidApiKey":{"description":"The `X-netmera-api-key` header is missing or the key is not valid.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}},"IpNotAllowed":{"description":"The application restricts REST calls to a list of allowed IP addresses and the caller's\nIP is not on it. The check runs after the API key is validated and before the request\nbody and parameters are validated, so a restricted application returns this error even\nfor a malformed request.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}}}},"paths":{"/rest/3.0/registerUsers":{"post":{"operationId":"registerUsers","tags":["Users"],"summary":"Register Users","description":"Registers users and their devices from your backend, or updates existing ones. Each array entry is\none registration: a device with its push token and platform, or an SMS-only user with an MSISDN.\n\n### How it works\n\n1. Netmera validates the whole request, then processes the registrations asynchronously.\n2. Each registration is matched to an existing user by `extId`. If none matches, a new user is\n   created.\n3. Optional tags and profile attributes in the entry are applied to the user: profile values are\n   merged into the existing profile and tags are added.\n\n<details>\n\n<summary>Notes</summary>\n\n- If any entry is invalid, the whole request is rejected with HTTP 400 and no entry is registered,\n  valid ones included.\n- An entry is invalid when it has neither `platform` nor `msisdn`, an unknown `platform`, `tags`\n  that is not an array, or an unreadable `profile` block.\n- An empty array is rejected with code `2020`.\n- A body that is a single object instead of an array returns HTTP 400, code `2001`, \"An unexpected\n  error occurred. Retry later.\".\n- If the `deviceToken` already belongs to a device, that device moves to this user. An anonymous\n  owner simply receives the `extId`.\n- If that device's owner has a different `extId`, the owner is not changed and a new user is created\n  instead.\n- Without a `deviceToken`, every call creates a new device, except for EMAIL and SMS platforms,\n  which get no device.\n- An email address or phone number held by another user moves to this user.\n- A previously deleted user is restored.\n\n</details>\n","parameters":[{"name":"X-netmera-app-xid","in":"header","required":false,"description":"External identifier of the application the registrations come from, recorded with every\nregistration; surrounding whitespace is trimmed. Without it the host name of the `Origin` header\nis used, and without both no identifier is recorded.\n","schema":{"type":"string"}},{"name":"Origin","in":"header","required":false,"description":"Used only when `X-netmera-app-xid` is absent: the host name of this URL is recorded as\nthe application identifier.\n","schema":{"type":"string","format":"uri"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","anyOf":[{"required":["platform"]},{"required":["msisdn"]}],"properties":{"extId":{"type":"string","description":"External user ID in your system. Recommended; needed to target the user in\nother endpoints.\n"},"platform":{"type":"string","description":"Device platform, case-insensitive; the value or its display name is accepted: `IOS`\n(`iOS`), `ANDROID` (`Android`), `WP` (`Windows`), `SMS` (`Sms`), `MACOS` (`Macos`,\nalso `SAFARI`), `CHROME`, `FIREFOX`, `WINDOWS`, `REST`, `WEBOTH` (`WebOther`), `EMAIL`\n(`Mail`), `OPERA`, `EDGE`, `YANDEX`, `WHATS_APP` (`WhatsApp`), `UNKNOWN`. Required\nunless `msisdn` is provided (the user is then stored as an SMS user); `WINDOWS` or\n`windows` resolves to `WP`, and an unknown value rejects the whole request with HTTP\n400, code `2001`.\n"},"deviceToken":{"type":"string","description":"Push token of the device."},"email":{"type":"string","description":"Email address of the user."},"msisdn":{"type":"string","description":"Phone number of the user, including the country code. Required unless\n`platform` is provided.\n"},"tags":{"type":"array","description":"Tag names to add to the user.","items":{"type":"string"}},"profile":{"type":"object","description":"Key-value object of profile attributes to set. Keys must match the\nattribute names defined in the panel exactly (case-sensitive); keys that do\nnot match an attribute name are dropped silently.\n","additionalProperties":true}}}}}}},"responses":{"200":{"description":"The registrations were accepted for processing."},"400":{"description":"No valid registration in the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}},"401":{"$ref":"#/components/responses/InvalidApiKey"},"403":{"$ref":"#/components/responses/IpNotAllowed"},"500":{"description":"Error responses the API can return.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/users/register-users.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
