GraphQL API
Hashboard publishes a public GraphQL API at https://hashboard.com/api/graphql
that you can use to programatically fetch project resources.
Authentication
Requests to the GraphQL API are authenticated with an API token. An API token is tied to a user in Hashboard and inherits all of that user's permissions.
To generate a new API token:
- Go to your Project Settings page (opens in a new tab)
- Click
Access Keys
on the left side navigation - Click
+ New Access Key
- Write a descriptive name for the API token, select
API token
as the Type, and clickCreate
The resulting screen will provide you with your API token. Save this in a safe place, as it cannot be re-created once you navigate away.
When making requests to the public GraphQL API, set the Authorization
header key to your API token:
curl https://hashboard.com/api/graphql \
-H "Authorization: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": "{ project(projectId: \"PROJECT_ID\") { name models { name } } }"}'
API tokens expire after 1 year.
Schema
The current public GraphQL schema is below and can also be inspected with introspection (opens in a new tab).
Currently, the public GraphQL API supports fetching metadata on Projects, Models, Saved Explorations, Metrics, Dashboards, Users and Roles.
Contact us if you are interested in accessing additional Hashboard resources via the public GraphQL API.
scalar JSON
scalar GRN
type Query {
project(projectId: ID!): Project
}
type Project {
id: ID!
name: String!
models: [Model!]!
metrics: [Metric!]!
dashboards: [Dashboard!]!
users: [User!]!
roles: [Role!]!
}
interface Resource {
grn: GRN!
name: String!
spec: JSON!
}
type Model implements Resource {
grn: GRN!
name: String!
spec: JSON!
viewsLastTwoWeeks: Int
savedExplorations: [SavedExploration]
}
type SavedExploration implements Resource {
grn: GRN!
name: String!
spec: JSON!
viewsLastTwoWeeks: Int
}
type Metric implements Resource {
grn: GRN!
name: String!
spec: JSON!
}
type Dashboard implements Resource {
grn: GRN!
name: String!
spec: JSON!
viewsLastTwoWeeks: Int
}
type User {
id: String!
fullName: String
displayName: String
email: String
roles: [String]
}
type Role {
id: String!
name: String!
description: String!
permissionRules: [PermissionRule]
}
type PermissionRule {
name: String!
resources: [String]!
permissions: [String]!
datasourceCredentials: [DataSourceCredentialsPermissions]
}
type DataSourceCredentialsPermissions {
datasourceName: String!
datasourceId: String!
credentialName: String!
credentialId: String!
}