API request·续5
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/byoip/service-bindings-account-info.mdx">src/content/partials/byoip/service-bindings-account-info.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/byoip/service-bindings-create-binding.mdx">src/content/partials/byoip/service-bindings-create-binding.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/byoip/validate-prefix-endpoint.mdx">src/content/partials/byoip/validate-prefix-endpoint.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/access/add-infrastructure-app.mdx">src/content/partials/cloudflare-one/access/add-infrastructure-app.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/access/add-target-generic.mdx">src/content/partials/cloudflare-one/access/add-target-generic.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/access/create-linked-app-token-policy.mdx">src/content/partials/cloudflare-one/access/create-linked-app-token-policy.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/access/create-service-token.mdx">src/content/partials/cloudflare-one/access/create-service-token.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/access/rule-group.mdx">src/content/partials/cloudflare-one/access/rule-group.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/get-started/create-http-policy.mdx">src/content/partials/cloudflare-one/gateway/get-started/create-http-policy.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/get-started/create-network-policy.mdx">src/content/partials/cloudflare-one/gateway/get-started/create-network-policy.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/lists.mdx">src/content/partials/cloudflare-one/gateway/lists.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/block-file-types.mdx">src/content/partials/cloudflare-one/gateway/policies/block-file-types.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/dns/block-applications.mdx">src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/dns/block-applications.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/dns/block-content-categories.mdx">src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/dns/block-content-categories.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/dns/block-security-categories.mdx">src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/dns/block-security-categories.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/http/block-applications.mdx">src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/http/block-applications.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/http/block-content-categories.mdx">src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/http/block-content-categories.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/network/enforce-device-posture.mdx">src/content/partials/cloudflare-one/gateway/policies/dash-plus-api/network/enforce-device-posture.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/mesh/pages/features/routes.mdx">src/content/partials/cloudflare-one/mesh/pages/features/routes.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/ssh/ssh-proxy-ca.mdx">src/content/partials/cloudflare-one/ssh/ssh-proxy-ca.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/cloudflare-one/upload-mtls-cert.mdx">src/content/partials/cloudflare-one/upload-mtls-cert.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/dns/add-mx-records.mdx">src/content/partials/dns/add-mx-records.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/dns/export-dns-records.mdx">src/content/partials/dns/export-dns-records.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/dns/internal-reference-zone-api.mdx">src/content/partials/dns/internal-reference-zone-api.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/dns/internal-zone-create-api.mdx">src/content/partials/dns/internal-zone-create-api.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/load-balancing/load-balancer-create-api.mdx">src/content/partials/load-balancing/load-balancer-create-api.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/load-balancing/monitor-create-api.mdx">src/content/partials/load-balancing/monitor-create-api.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/load-balancing/pool-create-api.mdx">src/content/partials/load-balancing/pool-create-api.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/logs/check-log-retention.mdx">src/content/partials/logs/check-log-retention.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/logs/disable-log-retention.mdx">src/content/partials/logs/disable-log-retention.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/logs/enable-log-retention.mdx">src/content/partials/logs/enable-log-retention.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/networking-services/mnm/get-started.mdx">src/content/partials/networking-services/mnm/get-started.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/networking-services/mnm/tutorials/encrypt-network-flow-data.mdx">src/content/partials/networking-services/mnm/tutorials/encrypt-network-flow-data.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/realtime/realtimekit/disable-a-meeting.mdx">src/content/partials/realtime/realtimekit/disable-a-meeting.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/realtime/realtimekit/end-a-session-backend.mdx">src/content/partials/realtime/realtimekit/end-a-session-backend.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/rules/origin-rules-api-change-host-header-dns-record.mdx">src/content/partials/rules/origin-rules-api-change-host-header-dns-record.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/rules/origin-rules-api-change-port.mdx">src/content/partials/rules/origin-rules-api-change-port.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/spectrum/spectrum-with-load-balancer-api.mdx">src/content/partials/spectrum/spectrum-with-load-balancer-api.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/ssl/aop-rollback-hostname-setup.mdx">src/content/partials/ssl/aop-rollback-hostname-setup.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/ssl/forward-client-certificate.mdx">src/content/partials/ssl/forward-client-certificate.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/waf/leaked-credentials-detection-enable.mdx">src/content/partials/waf/leaked-credentials-detection-enable.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/waf/managed-rulesets/api-account-example.mdx">src/content/partials/waf/managed-rulesets/api-account-example.mdx</a>
- <a href="https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/partials/waf/managed-rulesets/api-zone-example.mdx">src/content/partials/waf/managed-rulesets/api-zone-example.mdx</a>
</details>
Import
import { APIRequest } from "~/components";
Usage
import { APIRequest } from "~/components";
<APIRequest
path="/zones/{zone_id}/api_gateway/settings/schema_validation"
method="PUT"
json={{
validation_default_mitigation_action: "block",
}}
code={{
mark: [5, "block"],
}}
roles="Domain"
/>
<APIRequest
path="/zones/{zone_id}/hostnames/settings/{setting_id}/{hostname}"
method="DELETE"
parameters={{
setting_id: "ciphers",
}}
/>
<APIRequest
path="/accounts/{account_id}/images/v2/direct_upload"
method="POST"
form={{
requireSignedURLs: true,
metadata: '{"key":"value"}',
}}
/>
<APIRequest
path="/zones/{zone_id}/cloud_connector/rules"
method="PUT"
json={[
{
expression: 'http.request.uri.path wildcard "/images/*"',
provider: "cloudflare_r2",
description: "Connect to R2 bucket containing images",
parameters: {
host: "mybucketcustomdomain.example.com",
},
},
]}
/>
<APIRequest
path="/zones/{zone_id}/page_shield/scripts"
method="GET"
parameters={{
direction: "asc",
}}
/>
<APIRequest> Props
path
required
type: string
The path for the API endpoint.
This can be found in our API documentation ↗︎, 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:
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.
Functionally, the --json option ↗︎ is equivalent to the --data option in cURL, but handles a few additional headers automatically.
form
type: Record<string, any>
The FormData payload to send.
This field is not currently validated against the schema.
code
type: object
An object of Astro Code props. Refer to the Astro Code component documentation ↗︎ for available props.
roles
type: string | boolean
default: true
If set to true, which is the default, all API token roles will show.
If set to false, API token roles will not be displayed.
If set to a string, the API token roles will be filtered using it as a substring (i.e, roles="domain" to filter out Account API Gateway and only leave Domain API Gateway).
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/style-guide/build-the-page/components/api-request/#page","headline":"API request","description":"Generate curl commands from OpenAPI schema.","url":"https://developers.cloudflare.com/style-guide/build-the-page/components/api-request/","inLanguage":"en","image":"https://developers.cloudflare.com/style-guide/build-the-page/components/api-request/og.png?v=83055f2240c29d85","dateModified":"2026-08-20","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: List available notification types for a product. title: Available notifications image: https://developers.cloudflare.com/style-guide/build-the-page/components/available-notifications/og.png?v=7dd0963eb8824cd2
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/style-guide/llms.txt
Use this file to discover all available pages before exploring further.
Docs