{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Treasure Code","product_name":"Treasure Code","type":"markdown"},"seo":{"title":"tdx api - Raw HTTP Requests | Treasure AI","description":"Make raw HTTP requests to Treasure AI APIs with tdx api. Useful for exploring endpoints not yet wrapped by tdx commands.","siteUrl":"https://docs.treasure.ai","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]},"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"api","__idx":0},"children":["API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make raw HTTP requests to Treasure AI APIs, similar to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["gh api"]}," from GitHub CLI. Useful for inspecting endpoints during SDK or CLI design, or for calling APIs that tdx does not yet wrap."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Disabled by default"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api"]}," is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["disabled by default"]}," since v2026.7 to prevent AI assistants from making misconfigured requests that bypass tdx's structured commands. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/treasure-code/guide/api-command-safety"},"children":["API command safety"]}," for the rationale and how to enable it."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"enabling","__idx":1},"children":["Enabling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api"]}," is enabled only via a config file — there is no environment variable, on purpose (a one-line ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VAR=1 tdx api ..."]}," would let an AI session bypass the gate)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1. Global config (recommended)"]}," — add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["enable_api_command"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.config/tdx/tdx.json"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"enable_api_command\": true\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["2. Project config"]}," — add the same field to a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx.json"]}," in your project directory. This scopes the opt-in to one repo, but an AI editing the project can also flip it; prefer global config when safety matters."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When disabled, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api"]}," is hidden from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx --help"]},". Running it explicitly prints a guarded message that points at the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/treasure-code/guide/api-command-safety"},"children":["safety guide"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage","__idx":2},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"tdx api <endpoint> [options]\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"arguments","__idx":3},"children":["Arguments"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Argument"},"children":["Argument"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<endpoint>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["API path starting with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/"]},", e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v3/database/list"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"options","__idx":4},"children":["Options"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Option"},"children":["Option"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-X, --method <method>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["HTTP method (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DELETE"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATCH"]},"). Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--data <json>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Request body as a JSON string"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-f, --file <path>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Read the request body from a file"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-H, --header <header>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Custom header in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Key: Value"]}," format. Repeatable."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--type <api_type>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Which TD API to target (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cdp"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["workflow"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["trino"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["llm"]},"). Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":5},"children":["Examples"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# List databases\ntdx api /v3/database/list\n\n# Inspect a CDP parent segment\ntdx api /entities/parent_segments --type cdp\n\n# Issue a query\ntdx api -X POST --data '{\"query\":\"SELECT 1\"}' /v3/job/issue/hive/mydb\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prefer-structured-commands","__idx":6},"children":["Prefer structured commands"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Most use cases are better served by tdx's typed commands — they validate inputs, resolve names to IDs, and protect against the kinds of misconfiguration that motivated disabling ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api"]}," by default."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Instead of"},"children":["Instead of"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Use"},"children":["Use"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api /v3/database/list"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx db list"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api /v3/table/list/<db>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx table list <db>"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api -X POST --data '{\"query\":…}' /v3/job/issue/…"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx query \"<sql>\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api /entities/parent_segments --type cdp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx ps list"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx ps view"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api /api/workflows --type workflow"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx workflow list"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Reach for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx api"]}," when you are intentionally exploring an endpoint that tdx does not yet wrap, or debugging an API response shape."]}]},"headings":[{"value":"API","id":"api","depth":1},{"value":"Enabling","id":"enabling","depth":2},{"value":"Usage","id":"usage","depth":2},{"value":"Arguments","id":"arguments","depth":2},{"value":"Options","id":"options","depth":2},{"value":"Examples","id":"examples","depth":2},{"value":"Prefer structured commands","id":"prefer-structured-commands","depth":2}],"frontmatter":{"seo":{"title":"tdx api - Raw HTTP Requests | Treasure AI","description":"Make raw HTTP requests to Treasure AI APIs with tdx api. Useful for exploring endpoints not yet wrapped by tdx commands."}},"lastModified":"2026-06-23T01:20:02.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/treasure-code/commands/api","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}