This is the documentation for version 1.0.0 of the API. Last update on Apr 30, 2020.

Base URL
http://metabase.example.com

List Databases

Fetch all Databases. include_tables means we should hydrate the Tables belonging to each DB. include_cards here means we should also include virtual Table entries for saved Questions, e.g. so we can easily use them as source Tables in queries. Default for both is false.

Query parameters
  • include_tables boolean

    value may be nil, or if non-nil, value must be a valid boolean string ('true' or 'false').

  • include_cards boolean

    value may be nil, or if non-nil, value must be a valid boolean string ('true' or 'false').

Responses
GET /api/database
curl \
 -X GET http://metabase.example.com/api/database
Response example (200)
[
  {
    "id": 42,
    "name": "string",
    "description": "string",
    "features": [
      "string"
    ],
    "is_full_sync": true,
    "is_sample": true,
    "cache_field_values_schedule": "string",
    "metadata_sync_schedule": "string",
    "caveats": "string",
    "engine": "string",
    "created_at": "2021-05-04T09:42:00+00:00",
    "updated_at": "2021-05-04T09:42:00+00:00",
    "native_permissions": "string",
    "points_of_interest": "string",
    "details": {
      "connProperties": "connProperties",
      "let-user-control-scheduling": true,
      "password": "password",
      "dbname": "dbname",
      "port": 6,
      "host": "host",
      "user": "user",
      "authMech": 1
    },
    "tables": [
      {
        "schema": "schema",
        "entity_name": "entity_name",
        "description": "description",
        "active": true,
        "created_at": "2000-01-23 04:56:07 +0000",
        "rows": 5,
        "display_name": "display_name",
        "raw_table_id": "raw_table_id",
        "caveats": "caveats",
        "entity_type": "entity_type",
        "show_in_getting_started": true,
        "db_id": 2,
        "updated_at": "2000-01-23 04:56:07 +0000",
        "name": "name",
        "points_of_interest": "points_of_interest",
        "id": 5,
        "visibility_type": "visibility_type"
      }
    ]
  }
]

Execute a query

Execute a query and retrieve the results in the usual format.

Body
Responses
POST /api/dataset
curl \
 -X POST http://metabase.example.com/api/dataset \
 -H "Content-Type: application/json" \
 -d '{"database":0,"native":{"query":"query"},"query":{"limit":1,"page":{"page":5,"items":5},"source_table":6},"type":"native","constraints":{"max-results":2,"max-results-bare-rows":7}}'
Request example
{
  "database": 0,
  "native": {
    "query": "query"
  },
  "query": {
    "limit": 1,
    "page": {
      "page": 5,
      "items": 5
    },
    "source_table": 6
  },
  "type": "native",
  "constraints": {
    "max-results": 2,
    "max-results-bare-rows": 7
  }
}
Response example (200)
{
  "json_query": {
    "database": 0,
    "native": {
      "query": "query"
    },
    "query": {
      "limit": 1,
      "page": {
        "page": 5,
        "items": 5
      },
      "source_table": 6
    },
    "type": "native",
    "constraints": {
      "max-results": 2,
      "max-results-bare-rows": 7
    }
  },
  "data": {
    "results_metadata": {
      "columns": [
        {
          "special_type": "special_type",
          "base_type": "base_type",
          "name": "name",
          "display_name": "display_name"
        },
        {
          "special_type": "special_type",
          "base_type": "base_type",
          "name": "name",
          "display_name": "display_name"
        }
      ],
      "checksum": "checksum"
    },
    "rows_truncated": 1,
    "native_form": {
      "query": "query",
      "params": "params"
    },
    "columns": [
      "columns",
      "columns"
    ],
    "rows": [
      [
        "{}",
        "{}"
      ],
      [
        "{}",
        "{}"
      ]
    ],
    "cols": [
      {
        "special_type": "special_type",
        "description": "description",
        "remapped_to": "remapped_to",
        "schema_name": "schema_name",
        "source": "source",
        "table_id": 2,
        "display_name": "display_name",
        "fk_field_id": "fk_field_id",
        "target": {
          "special_type": "special_type",
          "base_type": "base_type",
          "name": "name",
          "description": "description",
          "id": 7,
          "display_name": "display_name",
          "table_id": 1,
          "visibility_type": "visibility_type"
        },
        "extra_info": "{}",
        "base_type": "base_type",
        "name": "name",
        "fingerprint": {
          "global": {
            "distinct-count": 1
          },
          "type": "{}"
        },
        "id": 4,
        "remapped_from": "remapped_from",
        "visibility_type": "visibility_type"
      },
      {
        "special_type": "special_type",
        "description": "description",
        "remapped_to": "remapped_to",
        "schema_name": "schema_name",
        "source": "source",
        "table_id": 2,
        "display_name": "display_name",
        "fk_field_id": "fk_field_id",
        "target": {
          "special_type": "special_type",
          "base_type": "base_type",
          "name": "name",
          "description": "description",
          "id": 7,
          "display_name": "display_name",
          "table_id": 1,
          "visibility_type": "visibility_type"
        },
        "extra_info": "{}",
        "base_type": "base_type",
        "name": "name",
        "fingerprint": {
          "global": {
            "distinct-count": 1
          },
          "type": "{}"
        },
        "id": 4,
        "remapped_from": "remapped_from",
        "visibility_type": "visibility_type"
      }
    ]
  },
  "context": "context",
  "started_at": "2000-01-23 04:56:07 +0000",
  "running_time": 3,
  "average_execution_time": "average_execution_time",
  "status": "status",
  "row_count": 9
}