---
title: API request · Cloudflare Style Guide
description: required
lastUpdated: 2025-04-22T19:07:40.000Z
source_url:
  html: https://kate-fixes-idpoktalogin.preview.developers.cloudflare.com/style-guide/components/api-request/index.md
  md: https://kate-fixes-idpoktalogin.preview.developers.cloudflare.com/style-guide/components/api-request/
---

## Import

```mdx
import { APIRequest } from "~/components";
```

## Usage

## `<APIRequest>` Props

### `path`

**required**

**type:** `string`

The path for the API endpoint.

This can be found in our [API documentation](https://api.cloudflare.com), under the name of the endpoint.

### `method`

**required**

**type:** `"GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD"`

The HTTP method to use.

### `parameters`

**type:** `Record<string, any>`

The parameters to substitute - either in the URL path or as query parameters.

For example, `/zones/{zone_id}/page_shield/scripts` can be transformed into `/zones/123/page_shield/scripts?direction=asc` with the following:

```mdx
parameters={{
  zone_id: "123",
  direction: "asc"
}}
```

If not provided, the component will default to an environment variable. For example, `{setting_id}` will be replaced with `$SETTING_ID`.

### `json`

**type:** `Record<string, any> | Record<string, any>[]`

The JSON payload to send.

If required properties are missing, the component will throw an error.

### `form`

**type:** `Record<string, any>`

The FormData payload to send.

This field is not currently validated against the schema.
