{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"TD-API Quickstart","description":"Get started with the Treasure Data REST API. Learn how to list databases, issue queries, retrieve results, and manage connectors programmatically.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","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":"treasure-data-td-api-quickstart","__idx":0},"children":["Treasure Data TD-API Quickstart"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The TD-API makes it easy to integrate with other tools to better manipulate your data. Through the Treasure API you can programmatically access the functionality typically provided through the web based Treasure Console."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This functionality includes:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Manage bulk imports of data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["List databases and tables"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Schedule jobs"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Manage connectors"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Manage users"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Access control policies"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By leveraging the TD-API endpoints you can create an external application, tool, or CLI to automate common tasks. For example, you may want to integrate TD-API with your continuous deployment service to run tests or setup complex automations."," ","Please refer to this ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/my-settings/getting-your-api-keys"},"children":["document"]}," for getting your API Keys."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"basic-use","__idx":1},"children":["Basic Use"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"list-databases","__idx":2},"children":["List Databases"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this case, you want to return a list of databases. This example issues a call to the API to return a list of your databases."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sample-request","__idx":3},"children":["Sample Request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -H \"AUTHORIZATION: TD1 YOUR_API_KEY_HERE\" \\\n\"https://api.treasuredata.com/v3/database/list\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sample-response","__idx":4},"children":["Sample Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"databases\": [\n    {\n      \"name\": \"database1\",\n      \"count\": 5000,\n      \"created_at\": \"2013-11-01 16:48:41 -0700\",\n      \"updated_at\": \"2013-11-01 16:48:41 -0700\",\n      \"organization\": null\n    },\n    {\n      \"name\": \"database2\",\n      \"count\": 5000,\n      \"created_at\": \"2013-11-08 17:47:22 -0800\",\n      \"updated_at\": \"2013-11-08 17:47:22 -0800\",\n      \"organization\": null\n    }\n  ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"issue-a-query","__idx":5},"children":["Issue a Query"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You might want to run a query to count how many visitors have come to your website."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["URI: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.treasuredata.com/v3/job/issue/presto/td_audit_log"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sample-request-1","__idx":6},"children":["Sample Request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --location --request POST \\\n     'https://api.treasuredata.com/v3/job/issue/presto/td_audit_log' \\\n     --header 'AUTHORIZATION: TD1 YOUR_API_KEY_HERE' \\\n     --header 'Content-Type: application/json' \\\n     --data-raw '{\n       \"query\": \"select * from access limit 5\",\n       \"domain_key\": 261,\n       \"Priority\": 0\n     }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sample-response-1","__idx":7},"children":["Sample Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"job\": \"1120145314\",\n  \"job_id\": \"1120145314\",\n  \"database\": \"td_audit_log\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"get-query-results","__idx":8},"children":["Get Query Results"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You might want to get query results for a specific job."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sample-request-2","__idx":9},"children":["Sample Request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --location --request GET 'https://api.treasuredata.com/v3/job/result/1145768692?format=json' \\\n    --header 'AUTHORIZATION: TD1 YOUR_API_KEY_HERE' \\\n    --header 'Content-Type: application/json' \\\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sample-response-2","__idx":10},"children":["Sample Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"[1,\"400\",\"num_requests\",1601378369]\n[2,\"404\",\"http_status_code\",1601378369]\n[3,\"200\",\"num_requests\",1601378369]\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"list-connectors","__idx":11},"children":["List Connectors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You might need to retrieve a list of connectors or to check if one exists or see if one has been added."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sample-request-3","__idx":12},"children":["Sample Request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -I -X GET \\\n  https://api.treasuredata.com/v3/result/list \\\n  -H 'Authorization: TD1 YOUR_API_KEY_HERE'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sample-response-3","__idx":13},"children":["Sample Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"name\": \"mb_s3_sep_6\",\n    \"url\": \"s3://test:xxx@s3-us-west-1.amazonaws.com/\",\n    \"organization\": null\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"further-reading","__idx":14},"children":["Further Reading"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now that you have the basics down, here are some suggested resources for you."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/workflows"},"children":["Tutorial"]}," - Use a continuous integration / continuous deployment service (CI / CD) tools such as Travis CI or Circle CI with TD-API"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/"},"children":["Treasure Toolbelt"]}," - Command Line Interface for Treasure Data services."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Data Clients - native language wrappers for the TD-API REST API."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/td-api/td-client/td-client-python"},"children":["Python td-client"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/td-api/td-client/td-client-ruby"},"children":["Ruby td-client"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/td-api/td-client/td-client-java"},"children":["Java td-client"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/td-api/td-client/td-client-node"},"children":["NodeJS td-client"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/td-api/td-client/td-client-go"},"children":["Go td-client"]}]}]}]},"headings":[{"value":"Treasure Data TD-API Quickstart","id":"treasure-data-td-api-quickstart","depth":1},{"value":"Basic Use","id":"basic-use","depth":1},{"value":"List Databases","id":"list-databases","depth":2},{"value":"Sample Request","id":"sample-request","depth":3},{"value":"Sample Response","id":"sample-response","depth":3},{"value":"Issue a Query","id":"issue-a-query","depth":2},{"value":"Sample Request","id":"sample-request-1","depth":4},{"value":"Sample Response","id":"sample-response-1","depth":4},{"value":"Get Query Results","id":"get-query-results","depth":2},{"value":"Sample Request","id":"sample-request-2","depth":4},{"value":"Sample Response","id":"sample-response-2","depth":4},{"value":"List Connectors","id":"list-connectors","depth":2},{"value":"Sample Request","id":"sample-request-3","depth":4},{"value":"Sample Response","id":"sample-response-3","depth":4},{"value":"Further Reading","id":"further-reading","depth":1}],"frontmatter":{"seo":{"title":"TD-API Quickstart","description":"Get started with the Treasure Data REST API. Learn how to list databases, issue queries, retrieve results, and manage connectors programmatically."}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/apis/td-api","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}