{"uid":"cap_IrIoKbgp51WksMUmX5g72","slug":"api-x402node-dev-490a476f","name":"Prettier Code Formatter API","description":"code formatter, prettier, code beautifier, JavaScript formatter, TypeScript formatter, JSON formatter, HTML formatter, CSS formatter, Markdown formatter, YAML formatter. Format code using Prettier. Supports JavaScript, TypeScript, JSON, HTML, CSS, Markdown, YAML, GraphQL. Auto-detects parser if not specified. For AI agents writing or fixing code in pipelines.","url":"https://api.x402node.dev/text/format","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"],"type":"string"},"queryParams":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Code (required)"},"parser":{"type":"string","description":"Parser (optional)"}}}},"additionalProperties":false}}},"responseSchema":null,"example":{"request":{"code":"const greeting = (name) => {\n  return 'Hello ' + name;\n};","parser":"babel"},"response":{"_hint":"x402 paid endpoints for AI agents — x402node.dev (utilities) · cn402.com (Chinese culture)","parser":"babel","formatted":"const greeting = (name) => {\n  return \"Hello \" + name;\n};\n","input_length":57,"output_length":58,"processing_ms":44}},"exampleRequest":{"code":"const greeting = (name) => {\n  return 'Hello ' + name;\n};","parser":"babel"},"tags":["x402"],"displayCostAmount":"0.0035","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.0035/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0035","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0035","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_0F6NfAUnItCDrlmhYaw9f","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0035","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Formats source code using Prettier, supporting JS, TS, JSON, HTML, CSS, Markdown, YAML, and GraphQL with auto-parser detection","exampleAgentPrompt":"Can you format this JavaScript code using Prettier? Here it is: `const x={a:1,b:2}; function hello(name){return 'Hello '+name;}`","exampleUseCases":null,"resultDescription":"Returns a JSON object with a `formatted` string containing the prettified code, along with the `parser` that was used, `input_length` and `output_length` character counts, and `processing_ms` indicating how long formatting took.","failureModes":["Unparseable code returns an error if Prettier cannot parse the given language","Unknown or unsupported parser specified causes a bad request error","Empty input body may result in a validation error","Very large code files may time out or exceed payload limits"],"whenToPreferThis":"Use this endpoint when an AI agent needs to auto-format or normalize source code in a pipeline — especially when producing, fixing, or transforming code in JS, TS, JSON, HTML, CSS, Markdown, YAML, or GraphQL and consistent style output is required. Prefer this over manual formatting or LLM-based reformatting for deterministic, standards-compliant Prettier output.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:48:04.161Z","isFirstParty":false}