# Register a participant
Sign up a participant for an event run. The event is derived from the event run ID.

POST /registration

## Headers
- Content-Type (string, required): Must be application/json.
- Idempotency-Key (string): Unique key to prevent duplicate creation on retry. UUID recommended.

## Request Body
- eventRunId (string, required): ID of the event run (distance) to register for
- email (string, required): Participant email address
- name (string): Participant display name
- registrationType (string, required): Registration type
- status (string, required): Registration status (defaults to confirmed)
- paceGroup (string): Pace group assignment
- notes (string): Additional notes

## Authorization
write:participants

## Request Examples

### curl
```curl
curl -X POST https://api.intervals.run/registration \
  -H "Authorization: Bearer INTERVALS_PARTNER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "eventRunId": "r41abc567def890",
    "email": "runner@example.com",
    "name": "Alex Johnson",
    "registrationType": "free",
    "status": "confirmed"
  }'
```

### JavaScript
```javascript
const res = await fetch(
  "https://api.intervals.run/registration",
  {
  method: "POST",
  headers: { Authorization: "Bearer INTERVALS_PARTNER_API_KEY" },
  body: JSON.stringify({
    "eventRunId": "r41abc567def890",
    "email": "runner@example.com",
    "name": "Alex Johnson",
    "registrationType": "free",
    "status": "confirmed"
  }),
  }
);
const { data } = await res.json();
```

## Responses

### 201 (201)
```json
{
  "data": {
    "participantId": "p89xyz345uvw678"
  }
}
```

### 404 (404)
```json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Event run not found"
  }
}
```

### 422 (422)
```json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request body",
    "errors": {
      "eventRunId": [
        "Required"
      ],
      "email": [
        "Required"
      ],
      "registrationType": [
        "Required"
      ]
    }
  }
}
```