Skip to main content

Management API: GraphQL API Management

You're reading API Gateway 2026.10.0. The newest release is 1.2.0. Go to the newest release

CRUD operations for GraphQL APIs

Create a new GraphQLApi​

POST /graphql-apis

Code samples


curl -X POST http://localhost:9090/api/management/v1/graphql-apis \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Add a new GraphQLApi to the Gateway.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "GraphQLApi",
"metadata": {
"name": "countries-graphql-api-v1.0"
},
"spec": {
"displayName": "Countries-GraphQL-API",
"version": "v1.0",
"context": "/countries/$version/graphql",
"upstream": {
"main": {
"url": "https://countries.trevorblades.com/graphql"
}
},
"policies": [
{
"name": "jwt-auth",
"version": "v1"
}
]
}
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
bodybodyGraphQLAPIRequesttruenone

Example responses

201 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "GraphQLApi",
"metadata": {
"name": "countries-graphql-api-v1.0"
},
"spec": {
"displayName": "Countries-GraphQL-API",
"version": "v1.0",
"context": "/countries/$version/graphql",
"upstream": {
"main": {
"url": "https://countries.trevorblades.com/graphql"
}
},
"policies": [
{
"name": "jwt-auth",
"version": "v1"
}
]
},
"status": {
"id": "countries-graphql-api-v1.0",
"state": "deployed",
"createdAt": "2026-08-11T10:00:00Z",
"updatedAt": "2026-08-11T10:00:00Z",
"deployedAt": "2026-08-11T10:00:00Z"
}
}

Responses​

StatusMeaningDescriptionSchema
201CreatedGraphQLApi created successfullyGraphQLAPI
400Bad RequestInvalid configuration (validation failed)ErrorResponse
409ConflictConflict - API with same name and version already existsErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

List all GraphQLApis​

GET /graphql-apis

Code samples


curl -X GET http://localhost:9090/api/management/v1/graphql-apis \
-u {username}:{password} \
-H 'Accept: application/json'

List GraphQLApis registered in the Gateway, optionally filtered by name, version, context, or status.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
displayNamequerystringfalseFilter by API display name
versionquerystringfalseFilter by API version
contextquerystringfalseFilter by API context/path
statusquerystringfalseFilter by deployment status

Enumerated Values​

ParameterValue
statusdeployed
statusundeployed

Example responses

200 Response

{
"status": "success",
"count": 1,
"graphqlApis": [
{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "GraphQLApi",
"metadata": {
"name": "countries-graphql-api-v1.0"
},
"spec": {
"displayName": "Countries-GraphQL-API",
"version": "v1.0",
"context": "/countries/$version/graphql",
"upstream": {
"main": {
"url": "https://countries.trevorblades.com/graphql"
}
},
"policies": [
{
"name": "jwt-auth",
"version": "v1"
}
]
},
"status": {
"id": "countries-graphql-api-v1.0",
"state": "deployed",
"createdAt": "2026-08-11T10:00:00Z",
"updatedAt": "2026-08-11T10:00:00Z",
"deployedAt": "2026-08-11T10:00:00Z"
}
}
]
}

Responses​

StatusMeaningDescriptionSchema
200OKList of GraphQLApisInline
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
countintegerfalsenonenone
graphqlApis[allOf]falsenonenone

allOf

NameTypeRequiredRestrictionsDescription
anonymousGraphQLAPIRequestfalsenonenone
apiVersionstringtruenoneAPI specification version
kindstringtruenoneAPI type
metadataMetadatatruenonenone
namestringtruenoneUnique handle for the resource
labelsobjectfalsenoneLabels are key-value pairs for organizing and selecting APIs. Keys must not contain spaces.
additionalPropertiesstringfalsenonenone
annotationsobjectfalsenoneAnnotations are arbitrary non-identifying metadata. Use domain-prefixed keys.
additionalPropertiesstringfalsenonenone
specGraphQLAPIConfigDatatruenonenone
displayNamestringtruenoneHuman-readable API name (must be URL-friendly - only letters, numbers, spaces, hyphens, underscores, and dots allowed)
versionstringtruenoneSemantic version of the API. Both major-only (v1) and major.minor (v1.0) forms are accepted.
contextstringtruenoneBase path for the single GraphQL endpoint (must start with /, no trailing slash). Use $version to embed the version in the path (e.g., /countries/$version resolves to /countries/v1.0). A GraphQLApi always exposes exactly one POST route at this path — there is no per-operation path list. Suggested (not enforced) convention: end the path with /graphql, matching how most standalone GraphQL servers name their single endpoint (e.g. /countries/$version/graphql) — this is not validated or required.
upstreamobjecttruenoneAPI-level upstream configuration. A GraphQLApi has exactly one logical endpoint (no per-operation paths), so upstream.main.url is the single GraphQL endpoint to proxy to. Only a direct inline url is supported — GraphQLAPIConfigData has no upstreamDefinitions list, so upstream.ref (used by RestApi to reference a predefined upstreamDefinition) cannot be resolved and is rejected.
mainUpstreamtruenoneUpstream backend configuration (single target or reference)
urlstring(uri)falsenoneDirect backend URL to route traffic to
refstringfalsenoneReference to a predefined upstreamDefinition
hostRewritestringfalsenoneControls how the Host header is handled when routing to the upstream. auto delegates host rewriting to Envoy, which rewrites the Host header using the upstream cluster host. manual disables automatic rewriting and expects explicit configuration.
tlsobjectfalsenoneNot supported on an inline upstream (a url-based main/sandbox entry); a tls block placed here is rejected at deploy time. Put it on the upstreamDefinitions entry referenced via ref.

oneOf

NameTypeRequiredRestrictionsDescription
anonymousobjectfalsenonenone

xor

NameTypeRequiredRestrictionsDescription
anonymousobjectfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
sandboxUpstreamfalsenoneUpstream backend configuration (single target or reference)
subscriptionPlans[string]falsenoneList of subscription plan names available for this API
policies[Policy]falsenoneList of policies applied to the GraphQL route(s). A GraphQLApi has
no operations[] list to add an explicit OPTIONS entry to the way
a RestApi does, so when a cors policy is attached, the gateway
synthesizes an OPTIONS route for the same path itself, sharing this
same policy chain — this is what lets cors (and every other
policy in this list, in declared order) answer a browser's
preflight request.
namestringtruenoneName of the policy
versionstringtruenoneVersion of the policy. Only major-only version is allowed (e.g., v0, v1). Full semantic version (e.g., v1.0.0) is not accepted and will be rejected. The Gateway Controller resolves the major version to the single matching full version installed in the gateway image.
executionConditionstringfalsenoneExpression controlling conditional execution of the policy
paramsobjectfalsenoneArbitrary parameters for the policy (free-form key/value structure)
deploymentStatestringfalsenoneDesired deployment state - 'deployed' (default) or 'undeployed'. When set to 'undeployed', the API is removed from router traffic but configuration, API keys, and policies are preserved for potential redeployment.

and

NameTypeRequiredRestrictionsDescription
anonymousobjectfalsenonenone
statusResourceStatusfalseread-onlyServer-managed lifecycle fields. Populated on responses.
idstringfalsenoneUnique identifier assigned by the server (equal to metadata.name)
statestringfalsenoneDesired deployment state reported by the server
createdAtstring(date-time)falsenoneTimestamp when the resource was first created (UTC)
updatedAtstring(date-time)falsenoneTimestamp when the resource was last updated (UTC)
deployedAtstring(date-time)falsenoneTimestamp when the resource was last deployed (omitted when undeployed)
warnings[Warning]falseread-onlyNon-fatal deploy-time findings (e.g. a policy's parameters resolved to something other than what was written, such as an omitted accept list inheriting the whole client-CA pool). Present only when non-empty.
codestringfalsenonenone
fieldstringfalsenonenone
messagestringfalsenonenone

Enumerated Values​

PropertyValue
apiVersiongateway.api-platform.wso2.com/v1
kindGraphQLApi
hostRewriteauto
hostRewritemanual
deploymentStatedeployed
deploymentStateundeployed
statedeployed
stateundeployed
codeMTLS_ACCEPT_INHERITS_POOL
codeMTLS_ACCEPT_UNNARROWED
codeMTLS_AUTH_NOT_FIRST
codeMTLS_ACCEPT_NAMES_RELAY_AUTHORITY
codeMTLS_THUMBPRINT_NORMALISED
codeHEADER_CERT_BYPASS_ACTIVE
codeMTLS_HOSTNAME_NOT_SCOPED
codeTLS_VERIFY_HOSTNAME_DISABLED
codeTLS_IDENTITY_EXPIRED

Get GraphQLApi by id​

GET /graphql-apis/{id}

Code samples


curl -X GET http://localhost:9090/api/management/v1/graphql-apis/{id} \
-u {username}:{password} \
-H 'Accept: application/json'

Get a GraphQLApi by its ID.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier for the API.

Detailed descriptions​

id: Unique public identifier for the API.

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "GraphQLApi",
"metadata": {
"name": "countries-graphql-api-v1.0"
},
"spec": {
"displayName": "Countries-GraphQL-API",
"version": "v1.0",
"context": "/countries/$version/graphql",
"upstream": {
"main": {
"url": "https://countries.trevorblades.com/graphql"
}
},
"policies": [
{
"name": "jwt-auth",
"version": "v1"
}
]
},
"status": {
"id": "countries-graphql-api-v1.0",
"state": "deployed",
"createdAt": "2026-08-11T10:00:00Z",
"updatedAt": "2026-08-11T10:00:00Z",
"deployedAt": "2026-08-11T10:00:00Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKGraphQLApi detailsGraphQLAPI
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Update an existing GraphQLApi​

PUT /graphql-apis/{id}

Code samples


curl -X PUT http://localhost:9090/api/management/v1/graphql-apis/{id} \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Update an existing GraphQLApi in the Gateway.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "GraphQLApi",
"metadata": {
"name": "countries-graphql-api-v1.0"
},
"spec": {
"displayName": "Countries-GraphQL-API",
"version": "v1.0",
"context": "/countries/$version/graphql",
"upstream": {
"main": {
"url": "https://countries.trevorblades.com/graphql"
}
},
"policies": [
{
"name": "jwt-auth",
"version": "v1"
}
]
}
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API to update.
bodybodyGraphQLAPIRequesttruenone

Detailed descriptions​

id: Unique public identifier of the API to update.

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "GraphQLApi",
"metadata": {
"name": "countries-graphql-api-v1.0"
},
"spec": {
"displayName": "Countries-GraphQL-API",
"version": "v1.0",
"context": "/countries/$version/graphql",
"upstream": {
"main": {
"url": "https://countries.trevorblades.com/graphql"
}
},
"policies": [
{
"name": "jwt-auth",
"version": "v1"
}
]
},
"status": {
"id": "countries-graphql-api-v1.0",
"state": "deployed",
"createdAt": "2026-08-11T10:00:00Z",
"updatedAt": "2026-08-11T10:00:00Z",
"deployedAt": "2026-08-11T10:00:00Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKGraphQLApi updated successfullyGraphQLAPI
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Delete a GraphQLApi​

DELETE /graphql-apis/{id}

Code samples


curl -X DELETE http://localhost:9090/api/management/v1/graphql-apis/{id} \
-u {username}:{password} \
-H 'Accept: application/json'

Delete a GraphQLApi from the Gateway.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API to delete.

Detailed descriptions​

id: Unique public identifier of the API to delete.

Example responses

200 Response

{
"status": "success",
"message": "GraphQLApi deleted successfully",
"id": "countries-graphql-api-v1.0"
}

Responses​

StatusMeaningDescriptionSchema
200OKGraphQLApi deleted successfullyInline
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
messagestringfalsenonenone
idstringfalsenonenone

Create a new API key for a GraphQL API​

POST /graphql-apis/{id}/api-keys

Code samples


curl -X POST http://localhost:9090/api/management/v1/graphql-apis/{id}/api-keys \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Generate a new API key for a GraphQLApi in the Gateway. The key is a 32-byte random value encoded in hexadecimal, prefixed with apip_. Use the API Key policy on the API to validate incoming requests with this key.

Payload

{
"name": "my-production-key"
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API to generate the key for
bodybodyAPIKeyCreationRequesttruenone

Detailed descriptions​

id: Unique public identifier of the API to generate the key for

Example responses

201 Response

{
"status": "success",
"message": "API key generated successfully",
"remainingApiKeyQuota": 9,
"apiKey": {
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
}

Responses​

StatusMeaningDescriptionSchema
201CreatedAPI key created successfullyAPIKeyCreationResponse
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Get the list of API keys for a GraphQL API​

GET /graphql-apis/{id}/api-keys

Code samples


curl -X GET http://localhost:9090/api/management/v1/graphql-apis/{id}/api-keys \
-u {username}:{password} \
-H 'Accept: application/json'

List all API keys for a GraphQLApi in the Gateway.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API to retrieve the keys for

Detailed descriptions​

id: Unique public identifier of the API to retrieve the keys for

Example responses

200 Response

{
"apiKeys": [
{
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
],
"totalCount": 3,
"status": "success"
}

Responses​

StatusMeaningDescriptionSchema
200OKList of API keysAPIKeyListResponse
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Regenerate API key for a GraphQL API​

POST /graphql-apis/{id}/api-keys/{apiKeyName}/regenerate

Code samples


curl -X POST http://localhost:9090/api/management/v1/graphql-apis/{id}/api-keys/{apiKeyName}/regenerate \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Regenerate an existing API key for a GraphQLApi in the Gateway. The previous key is revoked and replaced with a new 32-byte random value encoded in hexadecimal, prefixed with apip_.

Payload

{}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API to generate the key for
apiKeyNamepathstringtrueName of the API key to regenerate
bodybodyAPIKeyRegenerationRequesttruenone

Detailed descriptions​

id: Unique public identifier of the API to generate the key for

apiKeyName: Name of the API key to regenerate

Example responses

200 Response

{
"status": "success",
"message": "API key generated successfully",
"remainingApiKeyQuota": 9,
"apiKey": {
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKAPI key rotated successfullyAPIKeyCreationResponse
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Update an API key with a new regenerated value​

PUT /graphql-apis/{id}/api-keys/{apiKeyName}

Code samples


curl -X PUT http://localhost:9090/api/management/v1/graphql-apis/{id}/api-keys/{apiKeyName} \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Update an API key with a custom value instead of auto-generating one.

Payload

{
"name": "my-production-key"
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API
apiKeyNamepathstringtrueName of the API key to update
bodybodyAPIKeyUpdateRequesttruenone

Detailed descriptions​

id: Unique public identifier of the API

apiKeyName: Name of the API key to update

Example responses

200 Response

{
"status": "success",
"message": "API key generated successfully",
"remainingApiKeyQuota": 9,
"apiKey": {
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKAPI key updated successfullyAPIKeyCreationResponse
400Bad RequestInvalid request (validation failed)ErrorResponse
404Not FoundAPI or API key not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Revoke an API key​

DELETE /graphql-apis/{id}/api-keys/{apiKeyName}

Code samples


curl -X DELETE http://localhost:9090/api/management/v1/graphql-apis/{id}/api-keys/{apiKeyName} \
-u {username}:{password} \
-H 'Accept: application/json'

Revoke an API key. Once revoked, it can no longer be used to authenticate requests.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the API to revoke the key for
apiKeyNamepathstringtrueName of the API key to revoke

Detailed descriptions​

id: Unique public identifier of the API to revoke the key for

apiKeyName: Name of the API key to revoke

Example responses

200 Response

{
"status": "success",
"message": "API key revoked successfully"
}

Responses​

StatusMeaningDescriptionSchema
200OKAPI key revoked successfullyAPIKeyRevocationResponse
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundGraphQLApi not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Was this page helpful?