{
  "slug": "rest-file-to-curl",
  "name": "gizza-ai/rest-file-to-curl",
  "version": "0.1.0",
  "title": "REST File to cURL — convert a .http, .rest or .ain file into curl commands — gizza.ai",
  "description": "Paste a .http, .rest or .ain request file, supply variables or an environment, and get ready-to-run curl commands for bash, cmd or PowerShell. Browser-only.",
  "tags": [
    "rest file to curl",
    "http file to curl",
    ".http to curl",
    ".rest to curl",
    "ain file to curl",
    "rest client to curl",
    "convert http file to curl",
    "http request file converter"
  ],
  "category": "documents",
  "urls": {
    "page": "https://gizza.ai/tools/rest-file-to-curl/",
    "markdown": "https://gizza.ai/tools/rest-file-to-curl/index.md",
    "descriptor": "https://gizza.ai/tools/rest-file-to-curl/tool.json",
    "deep_link_example": "https://gizza.ai/tools/rest-file-to-curl/?data=%40host%20%3D%20https%3A%2F%2Fapi.example.com%0A%0A%23%23%23%20create%20item%0APOST%20%7B%7Bhost%7D%7D%2Fv1%2Fitems%20HTTP%2F1.1%0AContent-Type%3A%20application%2Fjson%0AX-Trace-Id%3A%20%7B%7Btrace_id%7D%7D%0A%0A%7B%22name%22%3A%22gizza%22%7D&env=%7B%22host%22%3A%22https%3A%2F%2Fapi.example.com%22%2C%22trace_id%22%3A%22abc123%22%7D&environment=prod&request=all&format=auto&shell=bash&flag_style=short&multiline=true&unresolved=keep&follow_redirects=true&compressed=true&insecure=true&include_comments=true"
  },
  "cli": "gizza tool rest-file-to-curl '@host = https://api.example.com\n\n### create item\nPOST {{host}}/v1/items HTTP/1.1\nContent-Type: application/json\nX-Trace-Id: {{trace_id}}\n\n{\"name\":\"gizza\"}'",
  "tool": {
    "description": "Convert a REST client request file into ready-to-run curl commands. Set 'data' to the contents of a .http/.rest file (the VS Code REST Client / JetBrains HTTP Client format: a 'GET https://api.example.com/users HTTP/1.1' request line, header lines, a blank line, then the body, with '###' separating multiple requests, '# @name id' naming one, '@name = value' declaring file variables and '{{name}}' referencing them) or an .ain file ([Method] [Host] [Query] [Headers] [Body] sections with $VAR substitution). Supply variable values in 'env' as a JSON object, a JSON document of named environments (then pick one with 'environment'), or KEY=VALUE lines; system variables {{$guid}}, {{$timestamp}}, {{$datetime}}, {{$randomInt}}, {{$processEnv}} and {{$dotenv}} are resolved too. 'request' picks one request by index or name (default all). Control the output with 'shell' (bash, cmd, powershell quoting), 'flag_style' (short or long flags), 'multiline', 'follow_redirects', 'compressed', 'insecure' and 'include_comments'; 'unresolved' decides whether missing variables are kept as placeholders, blanked, or reported as an error. Multi-line query continuations, form-body continuation lines and '< file' body references (rendered as --data-binary '@file') are handled. Nothing is ever sent — the file is parsed locally and returned as command text.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "compressed": {
          "default": false,
          "description": "Add curl's --compressed flag to request a gzip/deflate response. Default false.",
          "type": "boolean"
        },
        "data": {
          "description": "Contents of the request file. A .http/.rest file looks like \"GET https://api.example.com/users HTTP/1.1\" followed by header lines, a blank line, then the body; '###' separates several requests in one file, '@name = value' declares a variable and '{{name}}' references it. An .ain file uses [Method] [Host] [Query] [Headers] [Body] sections with $VAR substitution. Maximum 1000000 bytes.",
          "type": "string"
        },
        "env": {
          "default": "",
          "description": "Variable values to substitute, as either a JSON object ({\"host\":\"https://api.example.com\",\"token\":\"abc\"}), a JSON document of NAMED environments ({\"dev\":{...},\"prod\":{...}} — then set 'environment'), or plain KEY=VALUE lines like a .env file ('export ' prefixes, # comments and surrounding quotes are stripped). Leave blank to keep every variable unresolved.",
          "type": "string"
        },
        "environment": {
          "default": "",
          "description": "Which named environment to take variables from when 'env' is a JSON document of environments, e.g. 'dev' or 'prod'. Leave blank for a flat variable object.",
          "type": "string"
        },
        "flag_style": {
          "default": "short",
          "description": "Curl flag spelling: 'short' (default) uses -X/-H/-d/-L/-k; 'long' uses --request/--header/--data-raw/--location/--insecure.",
          "enum": [
            "short",
            "long"
          ],
          "type": "string"
        },
        "follow_redirects": {
          "default": false,
          "description": "Add curl's -L / --location flag so redirects are followed. Default false.",
          "type": "boolean"
        },
        "format": {
          "default": "auto",
          "description": "Input file format: 'auto' (default) detects .ain by its [Section] headers and otherwise parses .http/.rest; 'http' or 'ain' force one.",
          "enum": [
            "auto",
            "http",
            "ain"
          ],
          "type": "string"
        },
        "include_comments": {
          "default": true,
          "description": "true (default) prefixes each command with a '# name' comment line when the file has several requests or a named one; false emits only the commands.",
          "type": "boolean"
        },
        "insecure": {
          "default": false,
          "description": "Add curl's -k / --insecure flag to skip TLS certificate verification (useful against a local dev server with a self-signed certificate). Default false.",
          "type": "boolean"
        },
        "multiline": {
          "default": true,
          "description": "true (default) spreads the command over several lines with continuation characters, one flag per line; false emits a single line.",
          "type": "boolean"
        },
        "request": {
          "default": "all",
          "description": "Which request in the file to convert: 'all' (default) for every request, a 1-based index like '2', or a request name from a '# @name login' comment or a '### login' separator.",
          "type": "string"
        },
        "shell": {
          "default": "bash",
          "description": "Shell the generated command must run in — it sets the quoting and line-continuation style: 'bash' (default, also sh/zsh: single quotes, backslash continuations), 'cmd' (double quotes, ^ continuations), 'powershell' (single quotes with doubled escapes, ` continuations, and 'curl.exe' so it does not hit the Invoke-WebRequest alias).",
          "enum": [
            "bash",
            "cmd",
            "powershell"
          ],
          "type": "string"
        },
        "unresolved": {
          "default": "keep",
          "description": "What to do with a variable that has no value: 'keep' (default) leaves the {{placeholder}} in the command so you can fill it in, 'empty' substitutes an empty string, 'error' fails and lists the missing names.",
          "enum": [
            "keep",
            "empty",
            "error"
          ],
          "type": "string"
        }
      },
      "required": [
        "data"
      ],
      "type": "object"
    }
  }
}