# routes/joy-token

> Source: https://devdocs.joy.so/joy-headless-api/sdk-reference/hydrogen/routes/joy-token/ · Last updated: 2026-11-24

## Interfaces

### JoyCustomerAccount

The customer-account handle exposed on the Hydrogen route context.

#### Methods

##### isLoggedIn()

```ts
isLoggedIn(): Promise<boolean>;
```

###### Returns

`Promise`<`boolean`>

##### query()

```ts
query(query, options?): Promise<{
  data?:   | {
     customer?:   | {
        emailAddress?:   | {
           emailAddress?: string | null;
         }
           | null;
        firstName?: string | null;
        id?: string | null;
        lastName?: string | null;
      }
        | null;
   }
     | null;
  errors?: unknown;
}>;
```

###### Parameters

| Parameter  | Type      |
| ---------- | --------- |
| `query`    | `string`  |
| `options?` | `unknown` |

###### Returns

`Promise`<{
`data?`:   | {
`customer?`:   | {
`emailAddress?`:   | {
`emailAddress?`: `string` | `null`;
}
\| `null`;
`firstName?`: `string` | `null`;
`id?`: `string` | `null`;
`lastName?`: `string` | `null`;
}
\| `null`;
}
\| `null`;
`errors?`: `unknown`;
}>

***

### JoyTokenContext

The subset of the Hydrogen route context this handler needs.

#### Properties

##### customerAccount

```ts
customerAccount: JoyCustomerAccount;
```

##### env

```ts
env: JoyTokenEnv;
```

***

### JoyTokenEnv

Private + public env the merchant declares in their Hydrogen project (Oxygen).

#### Properties

##### JOY_API_SECRET?

```ts
JOY_API_SECRET?: string;
```

PRIVATE — the shop's secretKey. Server-only; never expose to the browser.

##### JOY_API_URL?

```ts
JOY_API_URL?: string;
```

Base URL of the Joy Headless API, e.g. `https://api.joy.so/app/api/v1/headless`.

##### JOY_SHOP_DOMAIN?

```ts
JOY_SHOP_DOMAIN?: string;
```

The shop's myshopify domain.

***

### JoyTokenLoaderArgs

Structural shape of a Hydrogen/Remix loader's args — only `context` is used.

#### Properties

##### context

```ts
context: JoyTokenContext;
```

##### request?

```ts
request?: Request;
```

## Functions

### loader()

```ts
function loader(__namedParameters): Promise<Response>;
```

Hydrogen resource-route loader. Always resolves to a `Response`; never throws.

#### Parameters

| Parameter           | Type                                        |
| ------------------- | ------------------------------------------- |
| `__namedParameters` | [`JoyTokenLoaderArgs`](#joytokenloaderargs) |

#### Returns

`Promise`<`Response`>
