codefmt Format API

The Format API from codefmt — 1 operation(s) for format.

GitHub OpenAPI

Operations 1

POST /api/format Format and lint code for a target automation platform #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/codefmt-dev:codefmt-dev-format-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

codefmt-dev-format-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Codefmt Dev Format API
  version: 1.0.0
  contact:
    name: codefmt
    url: https://codefmt.dev/contact
    email: support@codefmt.dev
  license:
    name: Proprietary
    url: https://codefmt.dev/privacy
  description: 'Operations tagged Format across 2 of this provider''s published API definitions: codefmt-dev-openapi.json, codefmt-dev-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://codefmt.dev
  description: Production
tags:
- name: Format
paths:
  /api/format:
    post:
      operationId: formatCode
      summary: Format and lint code for a target automation platform
      description: 'Wraps the supplied source in the platform-specific runtime shell, runs the appropriate formatter (Biome for JS, Ruff for Python, custom for HubL) and linter (oxlint for JS, Ruff for Python), then strips the wrapper and returns the formatted code with line-adjusted diagnostics. Naturally idempotent: formatting is a pure transformation with no server-side state, so retrying a request (with or without an Idempotency-Key) never duplicates anything.'
      parameters:
      - name: Api-Version
        in: header
        required: false
        schema:
          type: string
          enum:
          - '1'
        description: 'Major API version; "1" is the current and only version, and the default when omitted. Declaring an unsupported version returns 400 instead of silently serving different behavior. Policy: v1 is stable with additive-only changes; a breaking change would ship as /api/v2/format, with v1 kept serving through a deprecation window announced via Deprecation and Sunset headers on v1 responses.'
      - name: Idempotency-Key
        in: header
        required: false
        schema:
          type: string
          maxLength: 255
        description: Client-chosen retry key (e.g. a UUID), accepted for agent retry-safety and echoed back in the response's Idempotency-Key header. Because formatCode is pure, replaying the same key always yields an equivalent response; no deduplication window applies.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FormatRequest'
            examples:
              javascript:
                summary: Zapier JavaScript step with the site's default options
                value:
                  code: 'const name=inputData.name

                    return {greeting:"hi "+name}'
                  platform: zapier
                  formatOptions:
                    printWidth: 80
                    tabWidth: 2
                    useTabs: false
                    endOfLine: lf
                    semicolons: true
                    quoteStyle: single
                    trailingCommas: all
                    bracketSpacing: true
                    arrowParens: always
                    singleAttributePerLine: false
                    objectWrap: preserve
                    quoteProperties: as-needed
                    jsxQuoteStyle: double
                    bracketSameLine: false
                    organizeImports: false
                  lintOptions:
                    enabled: true
                    severity: default
                    typescriptPlugin: false
                    reactPlugin: false
                    unicornPlugin: false
                    promisePlugin: true
                    nodePlugin: true
                    securityPlugin: true
                    perfCategory: false
                    noConsole: false
              python:
                summary: Zapier Python step (language rides in platformVariants, which needs all four fields)
                value:
                  code: 'name=input_data[''name'']

                    output={''greeting'':''hi ''+name}'
                  platform: zapier
                  formatOptions:
                    printWidth: 80
                    tabWidth: 2
                    useTabs: false
                    endOfLine: lf
                    semicolons: true
                    quoteStyle: single
                    trailingCommas: all
                    bracketSpacing: true
                    arrowParens: always
                    singleAttributePerLine: false
                    objectWrap: preserve
                    quoteProperties: as-needed
                    jsxQuoteStyle: double
                    bracketSameLine: false
                    organizeImports: false
                  lintOptions:
                    enabled: true
                    severity: default
                    typescriptPlugin: false
                    reactPlugin: false
                    unicornPlugin: false
                    promisePlugin: true
                    nodePlugin: true
                    securityPlugin: true
                    perfCategory: false
                    noConsole: false
                  pythonFormatOptions:
                    lineLength: 88
                    indentWidth: 4
                    quoteStyle: double
                    lineEnding: lf
                    magicTrailingComma: true
                    pythonTarget: py313
                  pythonLintOptions:
                    enabled: true
                    pyflakes: true
                    pycodestyle: true
                    pycodestyleWarnings: false
                    isort: true
                    naming: false
                    pyupgrade: true
                    bugbear: true
                    security: false
                    comprehensions: false
                    simplify: false
                    ruff: false
                  platformVariants:
                    n8nMode: allItems
                    pipedreamType: action
                    hubspotStyle: callback
                    language: python
              hubl:
                summary: 'HubL template with a deprecated tag (diagnostics carry an unsafe fix, applied with applyFixes: "unsafe")'
                value:
                  code: '{% widget_block rich_text "intro" label="Intro" %}<p>Hello</p>{% end_widget_block %}'
                  platform: hubl
                  formatOptions:
                    printWidth: 100
                    tabWidth: 2
                    useTabs: false
                    endOfLine: lf
                    semicolons: true
                    quoteStyle: double
                    trailingCommas: all
                    bracketSpacing: true
                    arrowParens: always
                    singleAttributePerLine: false
                    objectWrap: preserve
                    quoteProperties: as-needed
                    jsxQuoteStyle: double
                    bracketSameLine: false
                    organizeImports: false
                  lintOptions:
                    enabled: true
                    severity: default
                    typescriptPlugin: false
                    reactPlugin: false
                    unicornPlugin: false
                    promisePlugin: true
                    nodePlugin: true
                    securityPlugin: true
                    perfCategory: false
                    noConsole: false
                  hublFormatOptions:
                    lintEnabled: true
                    disabledRuleCategories: []
                    tabWidth: 2
                    printWidth: 100
                    quoteStyle: double
                    htmlIndentation: true
                    blankLineBetweenBlocks: true
                    singleLineBlocks: false
                    preserveWhitespaceControl: true
                    unknownFilterSeverity: info
                    unknownGlobalSeverity: info
                    unknownFunctionSeverity: info
      responses:
        '200':
          description: Formatted code and diagnostics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormatResponse'
              examples:
                javascript:
                  summary: Response to the javascript example
                  value:
                    code: 'const name = inputData.name;

                      return { greeting: ''hi '' + name };

                      '
                    diagnostics: []
                    diagnosticsFrame: output
                    duration: 42
                python:
                  summary: Response to the python example
                  value:
                    code: 'name = input_data["name"]

                      output = {"greeting": "hi " + name}

                      '
                    diagnostics: []
                    diagnosticsFrame: output
                    duration: 12
                hubl:
                  summary: Response to the hubl example
                  value:
                    code: "{% widget_block rich_text \"intro\" label=\"Intro\" %}\n  <p>Hello</p>\n{% end_widget_block %}\n"
                    diagnostics:
                    - line: 1
                      column: 1
                      endLine: 1
                      endColumn: 51
                      message: '''widget_block'' is deprecated. Use ''module_block'' instead.'
                      severity: warning
                      fix:
                        description: Replace 'widget_block' with 'module_block'
                        safety: unsafe
                        edits:
                        - start:
                            line: 1
                            column: 4
                          end:
                            line: 1
                            column: 16
                          replacement: module_block
                        - start:
                            line: 1
                            column: 66
                          end:
                            line: 1
                            column: 82
                          replacement: end_module_block
                      rule: hubl/deprecated-tag
                    diagnosticsFrame: input
                    duration: 3
        '400':
          description: 'Validation error. `detail` names the first failing field (e.g. `lintOptions: Invalid input: expected object, received undefined`) and `hint` points to a complete body.'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: 'Forbidden: the request Origin/Referer is not in the allow-list (the API is intended for use from codefmt.dev). Requests with no Origin, such as curl or a server, are allowed.'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '413':
          description: 'Payload too large: the JSON request body exceeds 100KB. (A `code` field over 50KB is instead rejected as 400.)'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: 'Rate limited: 60 requests per minute per IP. Responses (success and 429 alike) carry IETF RateLimit-Limit/-Remaining/-Reset/-Policy headers so agents can self-throttle; the 429 adds Retry-After.'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      tags:
      - Format
    servers:
    - url: https://codefmt.dev
      description: Production
components:
  schemas:
    JsFormatOptions:
      type: object
      required:
      - printWidth
      - tabWidth
      - useTabs
      - endOfLine
      - semicolons
      - quoteStyle
      - trailingCommas
      - bracketSpacing
      - arrowParens
      - singleAttributePerLine
      - objectWrap
      properties:
        printWidth:
          type: integer
          minimum: 40
          maximum: 200
        tabWidth:
          type: integer
          enum:
          - 2
          - 4
        useTabs:
          type: boolean
        endOfLine:
          type: string
          enum:
          - lf
          - crlf
          - auto
        semicolons:
          type: boolean
        quoteStyle:
          type: string
          enum:
          - double
          - single
        trailingCommas:
          type: string
          enum:
          - all
          - es5
          - none
        bracketSpacing:
          type: boolean
        arrowParens:
          type: string
          enum:
          - always
          - avoid
        singleAttributePerLine:
          type: boolean
        objectWrap:
          type: string
          enum:
          - preserve
          - collapse
          - always
        quoteProperties:
          type: string
          enum:
          - as-needed
          - preserve
          default: as-needed
        jsxQuoteStyle:
          type: string
          enum:
          - double
          - single
          default: double
        bracketSameLine:
          type: boolean
          default: false
        organizeImports:
          type: boolean
          default: false
    PlatformVariants:
      type: object
      required:
      - n8nMode
      - pipedreamType
      - hubspotStyle
      - language
      properties:
        n8nMode:
          type: string
          enum:
          - allItems
          - eachItem
        pipedreamType:
          type: string
          enum:
          - action
          - source
          - codeStep
          description: '`codeStep` is a deprecated alias for `action` (legacy extension clients); it is coerced to `action` server-side.'
        makeModuleType:
          type: string
          enum:
          - action
          - search
          - trigger
          - aggregator
          description: 'Legacy field: accepted for back-compat but ignored server-side.'
        hubspotStyle:
          type: string
          enum:
          - callback
          - return
        language:
          $ref: '#/components/schemas/Language'
    Platform:
      type: string
      enum:
      - zapier
      - n8n
      - pipedream
      - make
      - hubspot
      - hubl
    Fix:
      type: object
      required:
      - description
      - safety
      - edits
      properties:
        description:
          type: string
        safety:
          type: string
          enum:
          - safe
          - unsafe
        edits:
          type: array
          items:
            $ref: '#/components/schemas/Edit'
    Edit:
      type: object
      required:
      - start
      - end
      - replacement
      properties:
        start:
          $ref: '#/components/schemas/Position'
        end:
          $ref: '#/components/schemas/Position'
        replacement:
          type: string
    JsLintOptions:
      type: object
      required:
      - enabled
      - severity
      - typescriptPlugin
      - reactPlugin
      - unicornPlugin
      - promisePlugin
      - nodePlugin
      - securityPlugin
      - perfCategory
      - noConsole
      properties:
        enabled:
          type: boolean
        severity:
          type: string
          enum:
          - default
          - warn
          - error
        typescriptPlugin:
          type: boolean
        reactPlugin:
          type: boolean
        unicornPlugin:
          type: boolean
        promisePlugin:
          type: boolean
        nodePlugin:
          type: boolean
        securityPlugin:
          type: boolean
        perfCategory:
          type: boolean
        noConsole:
          type: boolean
    FormatRequest:
      type: object
      required:
      - code
      - platform
      - formatOptions
      - lintOptions
      properties:
        code:
          type: string
          minLength: 1
          maxLength: 51200
          description: Source to format (≤50KB).
        platform:
          $ref: '#/components/schemas/Platform'
        formatOptions:
          $ref: '#/components/schemas/JsFormatOptions'
        lintOptions:
          $ref: '#/components/schemas/JsLintOptions'
        hublFormatOptions:
          $ref: '#/components/schemas/HublFormatOptions'
        pythonFormatOptions:
          $ref: '#/components/schemas/PythonFormatOptions'
        pythonLintOptions:
          $ref: '#/components/schemas/PythonLintOptions'
        platformVariants:
          $ref: '#/components/schemas/PlatformVariants'
        lintOnly:
          type: boolean
          description: Skip formatting, return diagnostics only.
        contentHint:
          type: string
          enum:
          - css
          - html
          - js
          description: 'HubL path only: what a buffer with no HubL in it is. Any {{ }} or {% %} still routes it to the HubL engine.'
        language:
          type: string
          description: 'Shorthand for platformVariants.language, the field MCP format_code takes: "javascript" or "python" (js and py are read the same way; typescript, ts and tsx read as javascript and turn on TypeScript parsing on pipedream). Used only when platformVariants is absent, which wins when both are sent; any other value is ignored, and python is ignored on hubl, which has no python runtime. Whenever it is not applied, the warnings member of the response says so.'
        applyFixes:
          type: string
          enum:
          - safe
          - unsafe
          description: 'Apply lint fixes, not only formatting: Biome''s fixes on JavaScript/TypeScript (''unsafe'' adds behaviour-changing ones), HubL''s fixes on HubL. Python ignores it.'
    FormatResponse:
      type: object
      required:
      - code
      - diagnostics
      - duration
      properties:
        code:
          type: string
          description: Formatted source.
        diagnostics:
          type: array
          items:
            $ref: '#/components/schemas/Diagnostic'
        diagnosticsFrame:
          type: string
          enum:
          - input
          - output
          description: 'Which text diagnostic positions refer to: the code you sent (HubL) or the formatted output (JavaScript, Python). Absent when diagnostics is empty by construction.'
        error:
          type: string
          description: Present only on partial failure; omitted entirely on success.
        warnings:
          type: array
          items:
            type: string
          description: Present only when the request carried a top-level language that was not applied (unrecognised, conflicting with platformVariants, or python on hubl), saying what happened.
        duration:
          type: integer
          description: Server processing time in milliseconds.
    PythonLintOptions:
      type: object
      required:
      - enabled
      - pyflakes
      - pycodestyle
      - pycodestyleWarnings
      - isort
      - naming
      - pyupgrade
      - bugbear
      - security
      - comprehensions
      - simplify
      - ruff
      properties:
        enabled:
          type: boolean
        pyflakes:
          type: boolean
        pycodestyle:
          type: boolean
        pycodestyleWarnings:
          type: boolean
        isort:
          type: boolean
        naming:
          type: boolean
        pyupgrade:
          type: boolean
        bugbear:
          type: boolean
        security:
          type: boolean
        comprehensions:
          type: boolean
        simplify:
          type: boolean
        ruff:
          type: boolean
    Diagnostic:
      type: object
      required:
      - line
      - column
      - message
      - severity
      - rule
      properties:
        line:
          type: integer
          description: 1-based.
        column:
          type: integer
          description: 1-based.
        endLine:
          type: integer
        endColumn:
          type: integer
        severity:
          type: string
          enum:
          - error
          - warning
          - info
          description: info comes from the HubL unknown filter/global/function checks.
        message:
          type: string
        rule:
          type: string
        fix:
          $ref: '#/components/schemas/Fix'
    Language:
      type: string
      enum:
      - javascript
      - python
    HublFormatOptions:
      type: object
      required:
      - tabWidth
      - printWidth
      - quoteStyle
      - htmlIndentation
      - blankLineBetweenBlocks
      - singleLineBlocks
      - preserveWhitespaceControl
      properties:
        tabWidth:
          type: integer
          enum:
          - 2
          - 4
          - 6
          - 8
        printWidth:
          type: integer
          minimum: 40
          maximum: 200
        quoteStyle:
          type: string
          enum:
          - double
          - single
        htmlIndentation:
          type: boolean
        blankLineBetweenBlocks:
          type: boolean
        singleLineBlocks:
          type: boolean
        preserveWhitespaceControl:
          type: boolean
        lintEnabled:
          type: boolean
        disabledRuleCategories:
          type: array
          items:
            type: string
            enum:
            - correctness
            - semantic
            - inheritance
            - deprecation
            - module-shape
            - hint
        unknownFilterSeverity:
          type: string
          enum:
          - 'off'
          - info
          - warning
          - error
        unknownGlobalSeverity:
          type: string
          enum:
          - 'off'
          - info
          - warning
          - error
        unknownFunctionSeverity:
          type: string
          enum:
          - 'off'
          - info
          - warning
          - error
    PythonFormatOptions:
      type: object
      required:
      - lineLength
      - indentWidth
      - quoteStyle
      - lineEnding
      - magicTrailingComma
      properties:
        lineLength:
          type: integer
          minimum: 40
          maximum: 200
        indentWidth:
          type: integer
          enum:
          - 2
          - 4
        quoteStyle:
          type: string
          enum:
          - double
          - single
        lineEnding:
          type: string
          enum:
          - lf
          - crlf
          - auto
        magicTrailingComma:
          type: boolean
        pythonTarget:
          type: string
          enum:
          - py37
          - py38
          - py39
          - py310
          - py311
          - py312
          - py313
          description: Target Python version. Clamped to the platform's real runtime when it is newer.
    Problem:
      type: object
      required:
      - type
      - title
      - status
      - detail
      - error
      properties:
        type:
          type: string
          enum:
          - urn:codefmt:problem:method-not-allowed
          - urn:codefmt:problem:forbidden-origin
          - urn:codefmt:problem:unsupported-api-version
          - urn:codefmt:problem:body-too-large
          - urn:codefmt:problem:invalid-request
          - urn:codefmt:problem:rate-limited
          description: Stable identifier for the problem class.
        title:
          type: string
        status:
          type: integer
          description: Mirrors the HTTP status.
        detail:
          type: string
          description: What went wrong with this request.
        error:
          type: string
          description: Same text as detail, kept for clients that read `error`.
        hint:
          type: string
          description: How to fix it, when there is a standard fix.
    Position:
      type: object
      required:
      - line
      - column
      properties:
        line:
          type: integer
        column:
          type: integer
externalDocs:
  description: Full API reference (llms.txt)
  url: https://codefmt.dev/llms.txt
x-refined-from:
- codefmt-dev-openapi.json
- codefmt-dev-openapi.yml