GraphQL API

Explore the CloudNexus infrastructure API. Query, mutate, and monitor your cloud resources in real-time.

Query Editor
# Query active infrastructure regions query GetRegions { regions { id name latency status capacity { available total } } }
Response
Press "Run" to execute query...

Introduction

The CloudNexus GraphQL API provides a unified interface to manage compute, storage, networking, and security resources. Unlike REST, GraphQL allows you to request exactly the data you need, reducing over-fetching and improving performance.

💡 Tip: Use the Playground tab above to test queries safely. Your API key is automatically injected when authenticated.

Authentication

All requests require authentication via Bearer token or API key. Generate keys in your dashboard under Settings → API Keys.

Authorization: Bearer cnx_live_sk_8f3a...x92k x-cnx-api-key: cnx_key_prod_7d4f...a1b2

Base URL

All GraphQL requests are sent to a single endpoint:

https://api.cloudnexus.io/graphql

Include the following headers for production requests:

Content-Type: application/json X-Client-Version: v2.4.1

Queries

Retrieve infrastructure data without side effects. Use queries to list resources, fetch metrics, or validate configurations.

QUERY getRegions, getInstances, getNetworks, getMetrics
query GetInstance($id: ID!) { instance(id: $id) { id name status region spec { cpu memory gpu } } }

Mutations

Create, update, or delete resources. Mutations return the modified resource and support optimistic updates.

MUTATION createInstance, updateRegion, deleteNetwork, scaleCluster
mutation CreateInstance { createInstance(input: { region: "us-east-1" plan: "PRO-8" image: "ubuntu-22.04" }) { instance { id status publicIp } errors { code message } } }

Rate Limits

GraphQL endpoints are limited to 1,000 requests/minute per API key. Burst limit: 200 req/min. Exceeding limits returns 429 Too Many Requests with a Retry-After header.

Region OBJECT

id: ID!
name: String!
code: String!
latency: Int!
status: RegionStatus!

Instance OBJECT

id: ID!
name: String!
status: InstanceState!
region: String!
publicIp: String

InstanceSpec INPUT

plan: String!
cpu: Int
memory: String
gpu: Boolean
storage: StorageConfig

Query ROOT

regions: [Region!!]!
instances(filter, pagination): InstanceConnection!
networks: [Network!!]!
metrics(range): MetricsData!

Mutation ROOT

createInstance: InstancePayload!
updateInstance: UpdatePayload!
deleteInstance: DeletePayload!
scaleCluster: ScalePayload!

Enum: RegionStatus ENUM

ACTIVE
DEGRADED
MAINTENANCE
OFFLINE