---
title: "v2PostAttributionEvents | TypeScript SDK | AEO API"
description: "Send referral, conversion or refund events that you have consent to record. Give each event its own external_event_id and consent_reference."
url: "https://aeoapi.dev/docs/sdks/typescript/v2PostAttributionEvents"
canonical: "https://aeoapi.dev/docs/sdks/typescript/v2PostAttributionEvents"
last_updated: "2026-11-30"
---

# v2PostAttributionEvents

Send referral, conversion or refund events that you have consent to record. Give each event its own external_event_id and consent_reference.

See the REST reference for [`POST /v2/attribution/events`](https://aeoapi.dev/docs/api-reference#post-v2-attribution-events).

## Signature

```
v2PostAttributionEvents(
  body: Record<string, unknown>,
  options?: {
    signal?: AbortSignal;
    idempotencyKey?: string;
  },
): Promise<ApiResponse<unknown>>
```

## Parameters

**`body`**

JSON object for this action. The example includes the fields for default.

**`options`**

Pass the named options in the signature. The selected action or view determines which fields are required.

**`options.signal`**

Optional AbortSignal to cancel the HTTP request.

**`options.idempotencyKey`**

The SDK generates a request key when you omit it. Pass the same key and body to retry this write in a separate call.

## Return value

Promise\<ApiResponse\<unknown\>\>. HTTP 202 includes data.ingestion_id, accepted and duplicate counts, and the rejected entries. Check rejected even when the request succeeds.

## Errors

- The SDK throws AeoApiError if the API returns an error. Inspect status, code, fieldErrors and requestId.
- AeoTransportError means the request failed to connect or the client could not finish reading a successful response. Invalid JSON in a successful response throws SyntaxError. If you abort the request, the SDK throws the reason from the AbortSignal.
- For HTTP 422, check fieldErrors for the input field and validation message.

## TypeScript example

```
import { AeoClient } from "@aeoapi/aeo-sdk";

const apiKey = process.env.AEO_API_KEY;
if (!apiKey) throw new Error("Set AEO_API_KEY on your server.");
const client = new AeoClient(apiKey, { baseUrl: "https://api.aeoapi.dev" });

// Substitute your own record IDs and values.
const body = {
  "events": [
    {
      "brand_id": "00000000-0000-4000-8000-000000000001",
      "consent_reference": "example",
      "external_event_id": "example",
      "kind": "referral",
      "occurred_at": "2026-11-06T00:00:00Z",
      "session_id": "example",
      "source": "example"
    }
  ],
  "max_units": 1
};
const response = await client.v2PostAttributionEvents(body);
console.log(response.status, response.body);
```

## Requests by feature

### Analytics and attribution

- [Send conversion and refund events](https://aeoapi.dev/docs/features/analytics-and-attribution/post-attribution-events-default)

See [TypeScript client setup](https://aeoapi.dev/docs/sdks/typescript) for authentication, timeouts and retry settings.
