# Bulk events

Generate up to 1000 creator group events in a single bulk operation.

The bulk operation API generates creator group events in batches, up to 1000 events at one time. Submit the events in the request body, then poll the returned bulk operation ID for status.

<ApiMethod method="POST" path="/event/bulk" />
<LinkCard title="View full reference" description="Parameters, responses, and status codes." href="/api/bounties/operations/bulkpostevent/" />

```bash
curl -X 'POST' \
  'https://api.nexus.gg/v1/bounties/event/bulk' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H 'X-SHARED-SECRET: nexus_sk_your_key_here' \
  -d '[{
    "eventCode": "greatGameLevel20",
    "playerId": "userUniqueIdentifier1",
    "referralCode": "popcornfrog"
  },{
    "eventCode": "greatGameLevel20",
    "playerId": "userUniqueIdentifier2",
    "referralCode": "popcornfrog"
  },{
    "eventCode": "greatGameLevel20",
    "playerId": "userUniqueIdentifier3",
    "referralCode": "popcornfrog"
  }]'
```

The status should be `200 OK` with a response body that is a string representing the ID of the bulk operation that was created.

```
5g_qQcsd6vVeq64buc2wc
```

## Checking bulk operation status

To check the status of a bulk event operation you have generated, you can use the following route:

<ApiMethod method="GET" path="/event/bulk/{bulkOperationId}" />
<LinkCard title="View full reference" description="Parameters, responses, and status codes." href="/api/bounties/operations/bulkposteventstatus/" />

```bash
curl -X 'GET' \
  'https://api.nexus.gg/v1/bounties/event/bulk/5g_qQcsd6vVeq64buc2wc' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H 'X-SHARED-SECRET: nexus_sk_your_key_here'
```

The status should be `200 OK` with a JSON response body that looks something like this:

```json
{
    "status": "complete",
    "startedAt": "2023-03-10T00:25:59.000Z",
    "completedAt": "2023-03-10T00:26:00.000Z",
    "errors": [
        {
            "message": "Conflict: greatGameLevel20- userUniqueIdentifier1",
            "operation": {
                "data": {
                    "eventCode": "greatGameLevel20",
                    "playerId": "userUniqueIdentifier1",
                    "referralCode": "popcornfrog"
                },
                "type": "attributionGroupEvent"
            }
        },
        {
            "message": "Conflict: greatGameLevel20- userUniqueIdentifier2",
            "operation": {
                "data": {
                    "eventCode": "greatGameLevel20",
                    "playerId": "userUniqueIdentifier2",
                    "referralCode": "popcornfrog"
                },
                "type": "attributionGroupEvent"
            }    
        }
    ],
    "log": [
        {
          "eventId": "J6n0VqyBtqisl_jd_41Z6",
          "referralCode": "popcornfrog",
          "playerId": "userUniqueIdentifier3"
        }
    ]
}
```

### Operation status

A status of `pending` indicates the operation has not yet started processing. During processing, the status will be `inProgress`. Upon completion, the status will become `complete` or `error`. An `error` status indicates that the bulk operation failed during processing due to an unexpected error, likely on our end. If this occurs, please contact support and we will assist you in correcting the issue.

### Operation errors

An operation of status `complete` may still include errors, but in this case the error will pertain to a specific event that was part of the operation, such as conflicts (where a non-repeatable event has already been logged) or invalid event codes.

### Operation log

The operation log is a list of the responses for the creation of each event in the bulk operation.

## Next steps

<LinkCard title="Creator group events" description="Log a single creator group event." href="/additional-features/bounties/creator-group-events/" />
<LinkCard title="Add a referral code" description="Apply a referral code to a player's past events." href="/additional-features/bounties/creator-group-events/add-referral-code/" />
