# Send product events from your server

`POST /analytics/events` · Rivier · analytics

Send product events from your server: a name, a few properties, your own id for the person (only a one-way digest of it is kept, tied to the day unless the person agreed) and whether they agreed. Values that look like an email address or a phone number are dropped.

- Scope: analytics:write
- Mcp: rivier_analytics_events_send
- Graphql: Mutation.analyticsEventSend
- Sdk: analytics.event.send
- Cli: analytics event send

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,59}$"
          },
          "anonymousId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Your own id for the person; it is never stored, only a one-way digest of it"
          },
          "properties": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 200
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "consent": {
            "type": "boolean",
            "description": "The person agreed to be recognised from one day to the next"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened; up to seven days back"
          }
        },
        "required": [
          "name",
          "anonymousId"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 100
    }
  },
  "required": [
    "events"
  ],
  "additionalProperties": false
}
```

## Responses

- `202`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/analytics/events' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "events": [
    {
      "name": "string",
      "anonymousId": "string"
    }
  ]
}'
```
