# Server-to-server attribution events

{% hint style="info" %}
Use this API to report attribution events from a trusted backend service. This gives you a secure way to submit events such as purchases, where the mobile app should not be treated as the source of truth.
{% endhint %}

Attribution events can be sent in batches to:

```
POST https://onside.io/attribution-api/v1/events
```

Use Basic authentication. Contact your Onside account contact to get credentials.

Example request:

```bash
curl -X POST \
  -H 'Content-Type: application/json' \
  -u <basic auth> \
  --data '{
    "events": [
      {
        "event_name": "purchase_completed",
        "payload": {
          "currency": "USD",
          "amount": "9.99"
        },
        "event_datetime": "2026-05-05T12:00:00Z",
        "event_id": "550e8400-e29b-41d4-a716-446655440000",
        "installation_id": "550e8400-e29b-41d4-a716-446655440000"
      }
    ]
  }' \
  https://onside.io/attribution-api/v1/events
```

### Request body

Example payload:

```json
{
  "events": [
    {
      "event_name": "purchase_completed",
      "payload": {
        "currency": "USD",
        "amount": "9.99"
      },
      "event_datetime": "2026-05-05T12:00:00Z",
      "event_id": "550e8400-e29b-41d4-a716-446655440000",
      "installation_id": "550e8400-e29b-41d4-a716-446655440000"
    }
  ]
}
```

`events` is an array of attribution events. It can contain up to 1,000 items.

Each event includes:

* `event_name` — The event name. Case-insensitive. **Required**
* `payload` — A JSON object with event properties. **Required**
* `event_datetime` — The time the event occurred on your server, in ISO 8601 format. **Required**
* `event_id` — A unique UUIDv4 used for idempotency. **Required**
* `installation_id` — The installation identifier returned by the Onside SDK in your app. **Required**

### Limits

* Send up to 1,000 events per request.
* Keep the total request payload under 1 MB.

### HTTP response codes

The endpoint can return the following HTTP status codes:

* `204 No Content` — The system accepted and queued the batch for processing.
* `400 Bad Request` — A validation error occurred. This includes malformed JSON and invalid UUIDs.
* `413 Payload Too Large` — The payload exceeds 1 MB or the batch contains more than 1,000 events.
* `429 Too Many Requests` — You have sent too many requests. Wait before you try again.


---

# 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.onside.io/api/onside-attribution/server-to-server-attribution-events.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.
