---
title: " "
sidebarTitle: prefect api
---

# `prefect api`



```command
prefect api [OPTIONS] METHOD PATH
```



<Info>
Make a direct request to the Prefect API.
</Info>






<AccordionGroup>


<Accordion title="Arguments" defaultOpen>
<ResponseField name="METHOD" type="string" required>
    HTTP method (GET, POST, PUT, PATCH, DELETE)  \[required]
</ResponseField>
<ResponseField name="PATH" type="string" required>
    API path (e.g., /flows, /flows/filter)  \[required]
</ResponseField>
</Accordion>



<Accordion title="Options" defaultOpen>

<ResponseField name="--data">
    Request body as JSON string or @filename
</ResponseField>

<ResponseField name="-H">
    Custom header in 'Key: Value' format
</ResponseField>

<ResponseField name="-v">
    Show request/response headers
</ResponseField>

<ResponseField name="--root">
    Access API root level (e.g., /api/me)
</ResponseField>

<ResponseField name="--account">
    Access account level (Cloud only)
</ResponseField>

</Accordion>

</AccordionGroup>


<Note>
**Example:**

```bash
# GET request
$ prefect api GET /flows/abc-123

# POST request with data
$ prefect api POST /flows/filter --data '{"limit": 10}'

# POST to filter endpoint (defaults to empty object)
$ prefect api POST /flows/filter

# Custom headers
$ prefect api POST /flows/filter -H "X-Custom: value" --data '{}'

# Verbose output
$ prefect api GET /flows --verbose

# Account-level operation (Cloud)
$ prefect api GET /workspaces --account

# API root level (Cloud only)
$ prefect api GET /me --root
```
</Note>

