Metabase

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

Base URL
http://metabase.example.com

Database

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
  • 200 array[object]

    successful operation

    • id Required / integer(int64)
    • name string
    • description string
    • features array[string]
    • is_full_sync boolean
    • is_sample boolean
    • cache_field_values_schedule string(cron-schedule)
    • metadata_sync_schedule string(cron-schedule)
    • caveats string

      type unknown

    • engine string
    • created_at string(date-time)
    • updated_at string(date-time)
    • native_permissions string
    • points_of_interest string

      type unknown

    • details object
      • host string
      • port integer(int32)
      • dbname string
      • authMech integer(int32)
      • user string
      • password string
      • connProperties string
      • let-user-control-scheduling boolean
    • tables array[object]
      • description string
      • entity_type string

        unknown type

      • schema string
      • raw_table_id string

        unknown type

      • show_in_getting_started boolean
      • name string
      • caveats string

        unknown type

      • rows integer(int64)
      • updated_at string(date-time)
      • entity_name string

        unknown type

      • active boolean
      • id integer(int64)
      • db_id integer(int64)
      • visibility_type string

        unknown type

      • display_name string
      • created_at string(date-time)
      • points_of_interest string

        unknown type

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"
      }
    ]
  }
]

Dataset

Execute a query

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

Body
  • database integer(int64)
  • type string

    Values are native and query.

  • native object
    • query string
  • query object

    Dataset query request and response object

    • source_table integer(int64)
    • limit integer(int64)
    • page object
      • page integer(int64)
      • items integer(int64)
  • constraints object
    • max-results integer(int64)
    • max-results-bare-rows integer(int64)
Responses
  • 200 object

    successful operation

    • started_at string(date-time)
    • json_query object
      • database integer(int64)
      • type string

        Values are native and query.

      • native object
        • query string
      • query object

        Dataset query request and response object

        • source_table integer(int64)
        • limit integer(int64)
        • page object
          • page integer(int64)
          • items integer(int64)
      • constraints object
        • max-results integer(int64)
        • max-results-bare-rows integer(int64)
    • average_execution_time string

      type unknown

    • status string
    • context string
    • row_count integer(int64)
    • running_time integer(int64)
    • data object
      • columns array[string]
      • array[array]
      • native_form object
        • query string
        • params string

          unknown type

      • cols array[object]
        • description string
        • table_id integer(int64)
        • schema_name string
        • special_type string
        • name string
        • source string
        • remapped_from string

          unknown type

        • extra_info object

          can be '{"target_table_id":517}'

        • fk_field_id string

          unknown type

        • remapped_to string

          unknown type

        • id integer(int64)
        • visibility_type string
        • target object
          • id integer(int64)
          • name string
          • display_name string
          • table_id integer(int64)
          • description string
          • base_type string
          • special_type string
          • visibility_type string
        • display_name string
        • fingerprint object
          • global object
            • distinct-count integer(int64)
          • type object

            map[string]DatasetQueryResultsColFingerprintType results in map[string]interface{}

        • base_type string
      • results_metadata object
        • checksum string
        • columns array[object]
          • base_type string
          • display_name string
          • name string
          • special_type string
      • rows_truncated integer(int64)
POST /api/dataset
$ curl \
 -X POST http://metabase.example.com/api/dataset \
 -H "Content-Type: application/json" \
 -d '{"database":42,"type":"native","native":{"query":"query"},"query":{"limit":1,"page":{"page":5,"items":5},"source_table":6},"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
}