# Fetch static content

Fetch default content from your backend.

```
POST https://api.croct.io/external/web/static-content
```

Retrieves the [default content](/explanation/content/slot-default-content) of a [slot](/explanation/slot) without applying audience targeting, experience evaluation, or experiment assignment. Use it for server-side rendering (SSR) or cache-friendly responses where personalization context is not available.

This is the server-side variant, intended for calls originating from your backend. It authenticates with an [API key](/explanation/application/api-keys) and applies rate limits tuned for backend traffic. For browser-accessible static content, use the [client-side variant](/reference/api/service/content/endpoint/client/static-content) instead.

## Example

Here is an example of how to fetch static content from a backend:

**JavaScript**

```js
const response = await fetch('https://api.croct.io/external/web/static-content', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': '<API KEY>',
  },
  body: JSON.stringify({
    slotId: 'home-hero',
    version: '1',
    preferredLocale: 'en-us',
    includeSchema: true,
  }),
});

const {content, metadata} = await response.json();
```

**cURL**

```bash
curl -X POST 'https://api.croct.io/external/web/static-content' \
  -H 'Content-Type: application/json' \
  -H 'X-Api-Key: <API KEY>' \
  -d '{
    "slotId": "home-hero",
    "version": "1",
    "preferredLocale": "en-us",
    "includeSchema": true
  }'
```

## Request headers

This endpoint accepts the following HTTP headers:

- `Content-Type`: `string`

  Must be `application/json`.

- `X-Api-Key`: `string`

  The [API key](/explanation/application/api-keys) to use for server-side requests.

  > **Keep your API key safe**
  >
  > Never use your API key in client-side code, only in server-side environments.

- `X-Client-Library`: `string` (optional)

  The SDK name and version, such as `Croct SDK JS v0.20.0`.

  Used for usage statistics and feature switching to preserve backward compatibility across SDK versions.

## Parameters

This endpoint accepts the following JSON body parameters:

- `slotId`: `string`

  The ID of the [slot](/explanation/slot) to fetch, such as `hero-banner`.

- `version`: `string` (optional)

  The schema version of the slot to fetch, in `major` or `major.minor` format, such as `1` or `1.2`.

  Defaults to the latest version when omitted.

- `preferredLocale`: `string|null` (optional)

  The locale code of the content to fetch.

  The code consists of a two-part string that specifies the language and, optionally, the country. For example, `en` represents English, `en-us` stands for English (United States), and `pt-br` for Portuguese (Brazil). It is case-insensitive and supports both hyphens and underscores as separators to accommodate the different conventions used by browsers, libraries, and other systems.

  Falls back to the slot's default locale when the preferred locale is unsupported or omitted. Pass `null` to explicitly use the default.

- `includeSchema`: `boolean` (optional) (default: )

  Whether to include the slot's [content schema](/reference/content/schema/introduction) in [`metadata.schema`](#metadata-schema-prop).

## Response

The service can respond with either `200 OK` or `202 Accepted` status code.

### 200 OK

Returns the requested content in a JSON body with the following properties:

- `content`: `object`

  The [slot](/explanation/slot)'s [default content](/explanation/content/slot-default-content).

  The shape is defined by the slot's content schema, plus a reserved `_component` field.

  - `_component`: `string|null`

    The component identifier and major version, such as `hero-banner@1`.

    Is `null` when no component is associated with the slot.

- `metadata`: `object`

  Metadata describing the returned content.

  - `version`: `string`

    The resolved slot schema version.

  - `contentSource`: `string`

    Always `slot` for static content requests, since neither audience targeting nor experiments are applied.

  - `schema`: [`Schema`](/reference/content/schema/introduction) (optional)

    The slot's content schema definition.

    Human-readable labels and descriptions are omitted from the returned schema for security reasons, since they may contain sensitive business information.

    This property is included only when the request set [`includeSchema`](#includeschema-prop) to `true`.

#### Example response

Here is an example of a JSON response from this endpoint:

```json
{
  "content": {
    "_component": "home-hero@1",
    "heading": "Welcome to Acme",
    "cta": {
      "label": "Get started",
      "link": "https://example.com/signup"
    }
  },
  "metadata": {
    "version": "1.0",
    "contentSource": "slot",
    "schema": {
      "root": {
        "type":"structure",
        "title":"Hero",
        "attributes": {
          "heading": {
            "position":0,
            "type": {
              "type":"text"
            }
          },
          "cta": {
            "position":1,
            "type": {
              "type":"structure",
              "attributes": {
                "label":{
                  "position":0,
                  "type":{
                    "type":"text"
                  }
                },
                "link": {
                  "position":1,
                  "type": {
                    "type":"text"
                  }
                }
              }
            }
          }
        }
      },
      "definitions": {}
    }
  }
}
```

### 202 Accepted

The request is accepted but the service is suspended and returns no content. Clients should treat this as a traffic control signal, not an error, and fall back to default behavior. The suspension reason is indicated by the `X-Suspension-Reason` header:

- `X-Suspension-Reason`: `string` (optional)

  The reason the API returned an empty response. The possible values are:

  | Value                                    | Description                                                                        |
  | ---------------------------------------- | ---------------------------------------------------------------------------------- |
  | `tracking_and_personalization_suspended` | The workspace has [suspended services](/explanation/workspace/service-suspension). |
