---
title: "Record Signup Attribution"
method: POST
path: "/users/me/attribution"
tags: ["users"]
---

# Record Signup Attribution

`POST /users/me/attribution`

Persist first-touch marketing attribution (UTM + gclid) for the user.

Write-once: each field is only set when currently NULL, so a later sign-in
never overwrites the original campaign. An empty payload is a no-op.

Args:
    request: First-touch attribution captured at signup.
    auth: Authenticated user context.

Returns:
    SignupAttributionResponse indicating whether anything was newly written.

Raises:
    HTTPException: 500 if the persistence layer fails.

## Request body

- SignupAttributionRequest — First-touch marketing attribution captured at signup. All fields are optional. Only non-null values are persisted, and each field is written once (first non-null wins) so a later sign-in never overwrites the original campaign. Values are length-bounded since they originate from untrusted URL/cookie input. Attributes: utm_source: Traffic source (e.g. 'google'). utm_medium: Marketing medium (e.g. 'cpc'). utm_campaign: Campaign name. utm_content: Ad/content variant. utm_term: Paid keyword (reserved for future use). gclid: Google click id for ads conversion attribution. twclid: X/Twitter click id for ads conversion attribution. rdt_cid: Reddit click id for ads conversion attribution.
  - `utm_source` string, nullable
  - `utm_medium` string, nullable
  - `utm_campaign` string, nullable
  - `utm_content` string, nullable
  - `utm_term` string, nullable
  - `gclid` string, nullable
  - `twclid` string, nullable
  - `rdt_cid` string, nullable

## Response `200`

Successful Response

- SignupAttributionResponse — Response for POST /users/me/attribution. Attributes: success: Whether the request was processed without error. recorded: Whether any attribution field was newly written (False when nothing was supplied or every field was already set).
  - `success` boolean, required
  - `recorded` boolean, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/revisions/31dfe831e079/schema)
