# csp

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

## Interfaces

### JoyCspDirectives

#### Properties

##### connectSrc

```ts
connectSrc: string[];
```

##### fontSrc

```ts
fontSrc: string[];
```

##### imgSrc

```ts
imgSrc: string[];
```

##### scriptSrc

```ts
scriptSrc: string[];
```

##### styleSrc

```ts
styleSrc: string[];
```

## Variables

### JOY_API_ORIGIN

```ts
const JOY_API_ORIGIN: "https://api.joy.so" = 'https://api.joy.so';
```

Default Joy Headless API origin.

***

### JOY_CDN_ORIGIN

```ts
const JOY_CDN_ORIGIN: "https://api.joy.so" = 'https://api.joy.so';
```

Default origin serving the widget core `widget-v4/**`.
Hosting serves it from `api.joy.so` — `static.joy.so/widget-v4/**` is not
published — so it currently equals [JOY_API_ORIGIN](#joy_api_origin).

***

### JOY_CSP_DIRECTIVES

```ts
const JOY_CSP_DIRECTIVES: JoyCspDirectives;
```

The directives for Joy's default hosted CDN + API.

## Functions

### joyCspDirectives()

```ts
function joyCspDirectives(opts?): JoyCspDirectives;
```

Derive directives from the actual asset/API URLs a merchant configured, for
setups that don't use Joy's default `api.joy.so` host (widget core + API).
Falls back to the defaults for any URL that is omitted or unparseable.

#### Parameters

| Parameter        | Type                                            |
| ---------------- | ----------------------------------------------- |
| `opts?`          | { `apiUrl?`: `string`; `assetUrl?`: `string`; } |
| `opts.apiUrl?`   | `string`                                        |
| `opts.assetUrl?` | `string`                                        |

#### Returns

[`JoyCspDirectives`](#joycspdirectives)
