> 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/events/fire-events.md). Agents can also search and read this documentation through its [MCP server](https://user.netmera.com/netmera-developer-guide/~gitbook/mcp).

# Fire Events

Sends custom events for users from your backend. Each event needs `extId` to identify the user and `name` for the event type; add attributes as key-value pairs, based on the event schema defined in the Netmera panel.

<details>

<summary>Notes</summary>

* The body must be a JSON array of event objects.
* Always send events server-side. Never expose the API key in client-side code.
* Use ISO 8601 format for all timestamps.
* Keep event names consistent with your defined taxonomy. Inconsistent names break segmentation.
* Include a source event reference on conversion events to enable attribution.
* Event names and eventCode values are case-sensitive. A value that differs only in case is an unknown event, and that event is rejected.
* An attribute key that differs only in case is silently ignored. If the attribute is mandatory, the event is rejected as missing it.
* If the request cannot be put into the processing queue, the error is only logged and the call still returns 200.

</details>

```json
{"openapi":"3.1.0","info":{"title":"Netmera REST API","version":"3.0"},"tags":[{"name":"Events","description":"Send events from your backend for analytics, segmentation and journeys.\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>Fire Events</strong></td><td><code>POST</code> Sends custom events for users from your backend.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/events/fire-events\">Fire Events</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":{"Event":{"type":"object","description":"A custom event. Beyond `extId` and `name`, additional event-specific attributes are\npassed as key-value pairs and must match the event schema defined in the Netmera panel.\n","required":["extId"],"properties":{"extId":{"type":"string","description":"Unique identifier of the user in your system."},"name":{"type":"string","description":"Name of the event. Required unless `eventCode` is sent."},"eventCode":{"type":"string","description":"Code of an existing event definition, as an alternative to `name`. Takes precedence over\n`name` when not empty.\n"},"msisdn":{"type":"string","description":"Phone number of the user, used instead of `extId` when the application uses phone numbers as\nexternal IDs or `extId` is empty (matched across phone number formats); a new user is created if\nnone matches. The `extId` key must still be present.\n"},"revenue":{"type":"number","description":"Revenue value of the event; a non-numeric value is read as 0. For purchase events it is replaced\nby the `grandTotal` attribute.\n"},"attr":{"type":"object","description":"Event attributes keyed by attribute code, including every mandatory attribute of the event. When\npresent, attributes sent at the top level of the event are ignored.\n","additionalProperties":true},"items":{"description":"Line items of a purchase event, required for purchase events and events based on it; send them\nat the top level, inside `prms` or inside `attr`. A single object counts as a one-item array, a\nstring must contain valid JSON, and each item is validated against the purchase line item event\n(an invalid item fails the whole request).\n","oneOf":[{"type":"array","items":{"type":"object","additionalProperties":true}},{"type":"object","additionalProperties":true},{"type":"string"}]},"prms":{"type":"object","description":"Wrapper object used by some client integrations for purchase events; `items` and `attr`\nare also looked up inside it.\n","additionalProperties":true}},"additionalProperties":true},"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."}}},"ProblemDetail":{"type":"object","description":"RFC 7807 error body returned by the framework instead of the Netmera error body when a\nrequired query parameter is missing or a parameter cannot be converted to its type.\n","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"}}}},"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/fireEvents":{"post":{"operationId":"fireEvents","tags":["Events"],"summary":"Fire Events","description":"Sends custom events for users from your backend. Each event needs `extId` to identify the user and\n`name` for the event type; add attributes as key-value pairs, based on the event schema defined in\nthe Netmera panel.\n\n<details>\n\n<summary>Notes</summary>\n\n- The body must be a JSON array of event objects.\n- Always send events server-side. Never expose the API key in client-side code.\n- Use ISO 8601 format for all timestamps.\n- Keep event names consistent with your defined taxonomy. Inconsistent names break segmentation.\n- Include a source event reference on conversion events to enable attribution.\n- Event names and eventCode values are case-sensitive. A value that differs only in case is an\n  unknown event, and that event is rejected.\n- An attribute key that differs only in case is silently ignored. If the attribute is mandatory, the\n  event is rejected as missing it.\n- If the request cannot be put into the processing queue, the error is only logged and the call\n  still returns 200.\n\n</details>\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}},"responses":{"200":{"description":"The events were accepted. Returns no response body.\n"},"400":{"description":"Error responses the API can return.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}},"401":{"$ref":"#/components/responses/InvalidApiKey"},"403":{"$ref":"#/components/responses/IpNotAllowed"}}}}}}
```


---

# 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/events/fire-events.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.
