# Create event

`POST https://api.nexus.gg/v1/bounties/event`

Logs a bounty event for a player and, optionally, credits it to the creator whose referral code triggered it. `eventCode` must match an event already configured for the creator group, or the request fails with `400 InvalidEventCode`. If `referralCode` is supplied, it must resolve to an approved member of the group, or the request fails with `400 ReferralNexusNotFound`. If the matching event is not repeatable and this `playerId` already has one, the request fails with `409`. The event is created and queued for bounty progress evaluation asynchronously, so a successful response does not mean any bounty's progress has updated yet. A request that fails schema validation (for example, a missing `playerId` or `eventCode`) returns `{status: 400, errors: [...]}`.

## Authorizations

- `X-SHARED-SECRET` (string, header, required)

## Query parameters

- `groupId` (string) - Creator group to use for this operation. If your key is scoped to a single program, that group is always used regardless of this value; otherwise falls back to your default group when omitted.

## Request body (`application-x-www-form-urlencoded`)

- `eventCode` (string, required) - The code representing the event to be logged
- `playerId` (string, required) - Unique id of the player that the event pertains to
- `referralCode` (string) - Optional code for the creator that referred this user

## Responses

### 200

Event created successfully

#### Body (`application/json`)

- `id` (string) - ID of the generated event
- `referralCode` (string) - Referral code the event was associated with
- `playerId` (string) - Player ID the event was associated with

### 400

bad request

#### Body (`application/json`)

- `code` (string) - CodeNotInGroup: Creator group is private, and specified code is not linked to it<br/> InvalidGroup: No creator group was found with the specified groupId<br/> InvalidAuthCode: AuthCode provided is not valid<br/> ExpiredAuthCode: AuchCode provided has expired<br/> ReferralNexusNotFound: No Nexus was found to match the provided referral code<br/> BountyNotFound: No bounty was found with the specified bountyId<br/> CreatorNotFound: No creator found with the specified creatorId<br/> InvalidEventCode: No event found with the specifed event code Allowed values: InvalidGroup, CodeNotInGroup, InvalidAuthCode, ExpiredAuthCode, ReferralNexusNotFound, BountyNotFound, MemberNotFound, InvalidEventCode, UnknownError.
- `message` (string)

```json
{
  "code": "InvalidEventCode",
  "message": "No event found with code: reachLevel20."
}
```

### 409

Event has already been logged and is not repeatable
