> For the complete documentation index, see [llms.txt](https://onchainlabs-tech-documentation.gitbook.io/wallettwo-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onchainlabs-tech-documentation.gitbook.io/wallettwo-documentation/api/events.md).

# Events

## Events API

Public API to manage events and attendees using an API key.

All endpoints are scoped to the company associated with the API key. An API key can only access and modify resources that belong to its own company.

### Authentication

All requests must include the API key in the `x-api-key` header:

```
x-api-key: <your-api-key>
```

The middleware verifies the key against the auth service and resolves the company (`referenceId`) it belongs to. Requests with a missing or invalid key are rejected.

### Base URL

```
https://api.wallettwo.com/events/v1/api
```

For the development environment, use `https://dev-api.wallettwo.com/events/v1/api`.

***

### Events

#### List events

Returns all events that belong to the API key's company, including the total number of attendees for each one.

```
GET /event
```

**Response**

```json
{
  "events": [
    {
      "id": "evt_123",
      "companyId": "cmp_abc",
      "name": "My Event",
      "location": "Madrid",
      "description": "...",
      "program": "...",
      "startDate": "2026-06-01T10:00:00.000Z",
      "endDate": "2026-06-01T18:00:00.000Z",
      "maxAttendees": 100,
      "price": 0,
      "currency": "EUR",
      "discountPrice": null,
      "discountPercentage": null,
      "contractRequiredToAttend": [],
      "contractRequiredToDiscount": [],
      "coverImage": null,
      "galleryImages": [],
      "chainId": null,
      "totalAttendees": 42
    }
  ]
}
```

***

#### Create an event

Creates a new event under the company of the API key. The `companyId` is taken automatically from the API key — it cannot be set in the body.

```
POST /event
```

**Body**

| Field                        | Type      | Description                                     |
| ---------------------------- | --------- | ----------------------------------------------- |
| `name`                       | string    | Event name                                      |
| `location`                   | string    | Event location                                  |
| `description`                | string    | Event description                               |
| `program`                    | string    | Event program/agenda                            |
| `startDate`                  | ISO date  | Start date                                      |
| `endDate`                    | ISO date  | End date                                        |
| `maxAttendees`               | number    | Maximum number of attendees                     |
| `price`                      | number    | Ticket price                                    |
| `currency`                   | string    | Currency code (e.g. `EUR`)                      |
| `discountPrice`              | number    | Discounted price                                |
| `discountPercentage`         | number    | Discount percentage                             |
| `contractRequiredToAttend`   | string\[] | NFT contract IDs required to attend             |
| `contractRequiredToDiscount` | string\[] | NFT contract IDs required to apply the discount |
| `coverImage`                 | string    | Cover image URL                                 |
| `galleryImages`              | string\[] | Gallery image URLs                              |
| `chainId`                    | number    | Blockchain network ID                           |

**Response**

Returns the newly created event.

```json
{
  "id": "evt_123",
  "companyId": "cmp_abc",
  "name": "My Event",
  "...": "..."
}
```

***

#### Get an event

Returns a single event by ID, including `totalAttendees`. The event must belong to the API key's company; otherwise the response is `Event not found`.

```
GET /event/{eventId}
```

**Response**

```json
{
  "id": "evt_123",
  "companyId": "cmp_abc",
  "name": "My Event",
  "totalAttendees": 42,
  "...": "..."
}
```

***

#### Update an event

Updates the provided fields of an existing event. Fields that are not included in the body are left unchanged.

```
POST /event/{eventId}
```

**Body**

Any subset of the same fields accepted by `POST /event` (except `companyId`, which is enforced from the API key).

**Response**

Returns the updated event.

***

#### Delete an event

Deletes the event and all its attendees. The event must belong to the API key's company.

```
DELETE /event/{eventId}
```

**Response**

```json
{ "message": "Event deleted successfully" }
```

***

### Attendees

All attendee endpoints are nested under an event and verify that the event belongs to the API key's company before doing anything.

#### List attendees

```
GET /event/{eventId}/attendees
```

**Response**

```json
{
  "attendees": [
    {
      "id": "att_1",
      "eventId": "evt_123",
      "attendeeId": "usr_xyz",
      "confirmedAt": null
    }
  ]
}
```

***

#### Add an attendee

Adds an attendee to the event. Fails if the attendee is already registered.

```
POST /event/{eventId}/attendees
```

**Body**

| Field        | Type   | Description                     |
| ------------ | ------ | ------------------------------- |
| `attendeeId` | string | User ID to register as attendee |

**Response**

Returns the newly created attendee record.

```json
{
  "id": "att_1",
  "eventId": "evt_123",
  "attendeeId": "usr_xyz",
  "confirmedAt": null
}
```

***

#### Remove an attendee

Removes an attendee from the event.

```
DELETE /event/{eventId}/attendees
```

**Body**

| Field        | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| `attendeeId` | string | User ID of the attendee to remove |

**Response**

```json
{ "message": "Attendee removed successfully" }
```

***

### Errors

Errors are returned with a descriptive message. Common cases:

| Message                                    | Cause                                                                |
| ------------------------------------------ | -------------------------------------------------------------------- |
| `x-api-key header missing.`                | The `x-api-key` header was not sent                                  |
| `Invalid API key.`                         | The auth service rejected the key                                    |
| `API key is not associated with a company` | The API key has no `referenceId`                                     |
| `Event not found`                          | The event does not exist or does not belong to the API key's company |
| `Attendee ID is required`                  | `attendeeId` is missing in the body                                  |
| `Attendee already invited`                 | The user is already registered for the event                         |
| `Attendee not found`                       | The user is not registered for the event                             |
