# HTTP Request to cURL & Fetch/Axios Code Converter

> HTTP Request to cURL & Fetch/Axios Code Converter is a paid API for AI agents from api.strale.io, paid per call via x402, $0.0216/call, status unknown (last checked 2026-09-14).

Converts HTTP request parameters (method, URL, headers, auth, body) into an equivalent curl command and fetch/axios code snippets

## Facts

- Endpoint: GET https://api.strale.io/x402/http-to-curl
- Price: $0.0216/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-strale-io-59ff2d29
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PBNhSyRKx1uj3FDInAAUd

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability api-strale-io-59ff2d29
```

Example prompt: Convert this GET request to a curl command and fetch/axios code: URL is https://api.example.com/users, with an Authorization header of 'Bearer abc123' and query params limit=10 and page=2.

## When to prefer this

Use this endpoint when you need to algorithmically and reliably convert a structured HTTP request definition into curl, fetch, and axios code without relying on an LLM to generate the syntax. Ideal for developer tooling, documentation generation, onboarding flows, or any scenario where reproducible, exact code output is required for GET, HEAD, or DELETE requests.

## Known failure modes

- Missing required 'input' or 'method' field returns a validation error
- Unsupported HTTP method (e.g. POST, PUT) rejected — only GET, HEAD, DELETE are accepted
- Missing URL in queryParams results in an incomplete or error response
- Malformed auth object may cause partial output or error
- Payment not processed or insufficient USDC balance results in 402 response

## How this service works

Convert HTTP request parameters to curl command + equivalent fetch/axios code. Supports auth, headers, body. Algorithmic.

## Output

Returns the equivalent curl command string along with JavaScript fetch and axios code snippets for the given HTTP request, including all specified headers, authentication, query parameters, and body.

## Example request

```json
{
 "url": "https://api.example.com/users",
 "body": "",
 "method": "GET",
 "headers": {
  "Content-Type": "application/json",
  "Authorization": "Bearer abc123"
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "url"
     ],
     "properties": {
      "url": {
       "type": "string"
      },
      "auth": {
       "type": "object"
      },
      "body": {},
      "method": {
       "type": "string"
      },
      "headers": {
       "type": "object"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-strale-io-59ff2d29/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
