{"uid":"cap_yPdehWzW-CXy8qwbCVK6U","slug":"api-strale-io-77fe3dd2","name":"curl-to-code converter","description":"Convert a curl command to equivalent code in TypeScript, Python, Go, Rust, Java, or PHP.","url":"https://api.strale.io/x402/curl-to-code?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":["curl_command"],"properties":{"curl_command":{"type":"string"},"target_language":{"type":"string"}}}},"additionalProperties":false}}},"responseSchema":null,"example":{"request":{"curl_command":"curl -X GET https://api.example.com/users -H 'Authorization: Bearer token123' -H 'Content-Type: application/json'","target_language":"TypeScript"},"response":{"code":"import fetch from 'node-fetch';\n\nconst response = await fetch('https://api.example.com/users', {\n  method: 'GET',\n  headers: {\n    'Authorization': 'Bearer token123',\n    'Content-Type': 'application/json'\n  }\n});\n\nconst data = await response.json();","_meta":{"payment":{"method":"x402","price_usd":0.054000000000000006,"settlement_id":"0x8084e3fe0707f26d46f54c96e6f6f88b9a4c1e27148f0fb1bae105fa89f46bf0"},"capability":"curl-to-code","latency_ms":1582,"provenance":{"source":"claude-haiku","fetched_at":"2026-06-13T04:25:27.827Z"}},"notes":["Alternatively, use the built-in fetch API if targeting Node.js 18+ or modern browsers","For Node.js 18+, remove the import and use fetch directly","Consider using axios or got for more robust HTTP client features"],"language":"typescript","dependencies_needed":["node-fetch"]}},"exampleRequest":{"curl_command":"curl -X GET https://api.example.com/users -H 'Authorization: Bearer token123' -H 'Content-Type: application/json'","target_language":"TypeScript"},"tags":["x402"],"displayCostAmount":"0.054001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.054001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.054","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.054","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_sLnwv9ybJQzynQbe-aKGH","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.054","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts a curl command into equivalent code in TypeScript, Python, Go, Rust, Java, or PHP","exampleAgentPrompt":"Can you convert this curl command to TypeScript for me: `curl -X POST https://api.example.com/data -H 'Content-Type: application/json' -d '{\"key\":\"value\"}'`?","exampleUseCases":null,"resultDescription":"Returns equivalent HTTP client code in the specified target language (TypeScript, Python, Go, Rust, Java, or PHP) that performs the same request as the original curl command, with proper headers, body, and method handling.","failureModes":["Invalid or malformed curl command returns an error","Unsupported target language returns validation error","Missing curl_command query parameter returns 400","Complex curl flags not supported may produce incomplete output","Network timeout for very complex commands"],"whenToPreferThis":"Use this endpoint when a developer or agent has a curl command (e.g. from API documentation) and needs idiomatic code in a specific programming language without manually translating HTTP methods, headers, and body encoding.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T18:47:15.275Z","isFirstParty":false,"canonicalSlug":"api-strale-io-77fe3dd2"}