> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# useFetchEvent

> Fetch a single event by ID

## Overview

`useFetchEvent` returns a callable that fetches one event by ID. Visibility is enforced server-side: if the event doesn't exist or the logged-in user can't see it, the request returns `404`. Pass `include` to expand associations and populate `userRsvp`.

## Usage Example

```tsx theme={null}
import { useFetchEvent } from "@sublay/react-js";

function useLoadEvent(eventId: string) {
  const fetchEvent = useFetchEvent();
  return () => fetchEvent({ eventId, include: ["user", "files", "userRsvp"] });
}
```

## Parameters

**eventId** `string` *required*

The event ID.

**include** `string | string[]`

Associations to expand: `"user"`, `"space"`, `"files"`, `"userRsvp"`.

## Returns

Returns a `Promise<Event>` — the [Event](https://docs.sublay.io/v7/data-models/event.md).

## See Also

* [Fetch Event API](https://docs.sublay.io/v7/api-reference/events/fetch-event.md)
* [EventProvider & useEvent](https://docs.sublay.io/v7/sdk/events/provider-and-hook.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.