Graphspace API
2.0 Graphspace
HugeGraph implements multi-tenancy through graph spaces, which isolate compute/storage resources per tenant.
Prerequisites
- Graphspace currently only works in HStore mode.
- In non-HStore mode you can only use the default graphspace
DEFAULT; creating/deleting/updating other graphspaces is not supported. - Set
usePD=trueinrest-server.propertiesandbackend=hstoreinhugegraph.properties. - Production requires Server authentication and authorization, and
auth=truefor new graph spaces. Replace the public default administrator passwordpaconfigured byauth.admin_pa. - Every endpoint on this page requires PD mode. In standalone mode they answer
400with the messageGraphSpace management is not supported in standalone mode.
Restrict graph-space listing and detail endpoints
GET /graphspaces and GET /graphspaces/{graphspace} have no @RolesAllowed annotation. They are anonymous when Server authentication is disabled and lack method-level administrator checks when it is enabled. Detail responses contain dp_username and dp_password. In production, set white_ip.status=enable and maintain the IP allowlist. A gateway must restrict both paths by caller identity or role to administrators and trusted operators; restricting only source IPs still lets ordinary authenticated accounts on that network read DP credentials. Server network policy must allow only trusted gateway egress addresses to the API port, blocking direct client bypass. Record caller identity, source, and outcome at the gateway. Server audit-*.log files record authentication and authorization but do not replace gateway access auditing for these paths. Grant business accounts minimum permissions.
2.0.1 Create a graphspace
Method & Url
Request Body
Note: CPU/memory and Kubernetes-related capabilities are not publicly available yet.
| Name | Required | Type | Default | Range/Note | Description |
|---|---|---|---|---|---|
| name | Yes | String | Lowercase letters, digits, underscore; must start with a letter; max length 48 | Graphspace name | |
| nickname | No | String | name | Must be unique among graphspaces | Display name of the graphspace |
| description | No | String | Description | ||
| cpu_limit | Yes | Int | > 0 | CPU cores for the graphspace | |
| memory_limit | Yes | Int | > 0 (GB) | Memory quota in GB | |
| storage_limit | Yes | Int | > 0 | Maximum disk usage, in GB | |
| compute_cpu_limit | No | Int | 0 | >= 0 | Extra HugeGraph-Computer CPU cores; falls back to cpu_limit if unset or 0 |
| compute_memory_limit | No | Int | 0 | >= 0 | Extra HugeGraph-Computer memory in GB; falls back to memory_limit if unset or 0 |
| oltp_namespace | No | String | "" | Kubernetes namespace for OLTP HugeGraph-Server | |
| olap_namespace | No | String | "" | Resources are merged when identical to oltp_namespace | Kubernetes namespace for OLAP / HugeGraph-Computer |
| storage_namespace | No | String | "" | Kubernetes namespace for HugeGraph-Store | |
| operator_image_path | No | String | "" | HugeGraph-Computer operator image registry | |
| internal_algorithm_image_url | No | String | "" | HugeGraph-Computer algorithm image registry | |
| max_graph_number | Yes | Int | > 0 | Maximum number of graphs that can be created inside the graphspace | |
| max_role_number | No | Int | 0 | Maximum number of roles that can be created inside the graphspace | |
| auth | No | Boolean | false | true / false | Whether to enable authentication for the graphspace |
| configs | No | Map | Additional configuration |
Response Status
Response Body
2.0.2 List all graphspaces
Method & Url
Response Status
Response Body
2.0.3 Get graphspace details
Params
Path parameters
- graphspace: Graphspace name
Method & Url
Response Status
Response Body
The
dp_usernameanddp_passwordvalues above are documentation examples. Real detail responses contain the graph space’s DP credentials and must be protected as sensitive credentials.
2.0.4 Update a graphspace
authcannot be changed once a graphspace is created.
Params
Path parameter
- graphspace: Graphspace name
Request parameters
- action: Must be
"update" - update: Container for the actual fields to update (see table below)
| Name | Required | Type | Range/Note | Description |
|---|---|---|---|---|
| name | Yes | String | Must match the graphspace name in the path | Graphspace name |
| nickname | No | String | Must be unique among graphspaces | Display name of the graphspace |
| description | No | String | Description | |
| cpu_limit | Yes | Int | > 0 | CPU cores for OLTP HugeGraph-Server |
| memory_limit | Yes | Int | > 0 (GB) | Memory quota (GB) for OLTP HugeGraph-Server |
| storage_limit | Yes | Int | > 0 | Maximum disk usage, in GB |
| compute_cpu_limit | No | Int | >= 0 | Extra HugeGraph-Computer CPU cores; falls back to cpu_limit if unset or 0 |
| compute_memory_limit | No | Int | >= 0 | Extra HugeGraph-Computer memory in GB; falls back to memory_limit if unset or 0 |
| oltp_namespace | Yes | String | Kubernetes namespace for OLTP HugeGraph-Server | |
| olap_namespace | Yes | String | Resources are merged when identical to oltp_namespace | Kubernetes namespace for OLAP |
| storage_namespace | Yes | String | Kubernetes namespace for HugeGraph-Store | |
| operator_image_path | No | String | HugeGraph-Computer operator image registry | |
| internal_algorithm_image_url | No | String | HugeGraph-Computer algorithm image registry | |
| max_graph_number | Yes | Int | > 0 | Maximum number of graphs |
| max_role_number | Yes | Int | > 0 | Maximum number of roles |
Method & Url
Request Body
Response Status
Response Body
2.0.5 Delete a graphspace
Params
Path parameter
- graphspace: Graphspace name
Method & Url
Response Status
Warning: deleting a graphspace releases all resources that belong to it.
2.0.6 List all graphspaces with their details
Params
Query parameters
- prefix: Return only the graphspaces whose name or nickname starts with this prefix
Method & Url
Response Status
Response Body
Each entry carries the same fields as GET /graphspaces/{graphspace} plus authed, default, create_time and update_time. authed says whether the current user may enter the graphspace: it is false when the graphspace has authentication on and the user is neither an administrator, nor a manager, nor a member of it. default is always false for now, the default-graphspace feature is not implemented yet.
Default roles
Every graphspace carries four built-in roles, so that a user or a group can be given a whole set of permissions at once:
space: manager of the graphspace, only an administrator may grant itspace_member: member of the graphspaceanalyst: analyst of the graphspaceobserver: read-only role, it can be narrowed to a single graph by passinggraph
user accepts either a user name or a group name. Whether the current user holds a default role can also be checked with GET /graphspaces/{graphspace}/auth/managers/default, see Authentication API.
2.0.7 Grant a default role
Params
Path parameter
- graphspace: Graphspace name
Request parameters
- user: User or group name, required
- role: One of
space,space_member,analyst,observer, required - graph: Graph name, optional, only taken into account with
role=observer
Method & Url
Request Body
Response Status
Response Body
graph is echoed back only when the role was granted on a single graph.
2.0.8 Check a default role
Params
Path parameter
- graphspace: Graphspace name
Query parameters
- user: User or group name, required
- role: Default role name, required
- graph: Graph name, optional, only taken into account with
role=observer
Method & Url
Response Status
Response Body
2.0.9 Revoke a default role
Params
Path parameter
- graphspace: Graphspace name
Query parameters
- user: User or group name, required
- role: Default role name, required
- graph: Graph name, optional, only taken into account with
role=observer
Method & Url
Response Status
Schema templates
A schema template stores a Gremlin schema script under a name, so that a new graph can be initialized with it by passing schema when the graph is created, see Graphs API. A template can be updated or deleted by its creator, by a manager of the graphspace, or by an administrator.
2.0.10 Create a schema template
Params
Path parameter
- graphspace: Graphspace name
Request parameters
- name: Template name, required
- schema: Gremlin schema script, required
Method & Url
Request Body
Response Status
Response Body
2.0.11 List the schema templates of a graphspace
Method & Url
Response Status
Response Body
2.0.12 Get a schema template
Method & Url
Response Status
2.0.13 Update a schema template
Only schema can be updated, the name of a template is fixed.