IBM Cloud API Docs

Introduction

Within IBM Cloud, you can easily create API proxies and custom APIs backed by IBM Cloud™ Functions, Cloud Foundry apps, and IBM® App Connect flows. The Legacy API Gateway you to securely share your APIs with other developers.

The Legacy API Gateway can handle APIs located in Cloud Foundry spaces, where access is controlled by roles. A space provides users with access to a shared location for app development, deployment, and maintenance. Cloud Foundry roles grant access to spaces, but offer no control over user actions.

For more information on using Legacy API Gateway, see Getting Started.

API endpoint

https://api.<region>.apigw.cloud.ibm.com

Replace <region> with the prefix that represents the geographic area where your APIs reside. For more information on determining the region, see Managing APIs.

Authentication

Most API methods require an Authorization header that includes a token with your IBM Cloud Identity and Access Management (IAM) credentials.

The header should look like this: Authorization: Bearer <token>

Error handling

The APIs managed by Legacy API Gateway use standard HTTP response codes to indicate whether a method completed successfully.

HTTP Error Code Description Recovery
200 Success The request was successful.
400 Bad Request The input parameters in the request body are either incomplete or in the wrong format. Be sure to include all required parameters in your request.
401 Unauthorized You are not authorized to make this request. Log in to IBM Cloud and try again. If this error persists, contact your account owner to check your permissions.
403 Forbidden The supplied authentication is not authorized.
404 Not Found The requested resource could not be found.
408 Request Timeout The connection to the server timed out. Wait a few minutes, then try again.
409 Conflict The entity is already in the requested state.
429 Too Many Requests You have made too many requests to this endpoint and are being rate limited / throttled.
500 Internal Server Error App ID is currently unavailable. Your request could not be processed. Wait a few minutes and try again.

Methods

Get details for all Endpoints

GET /v1/endpoints

Request

Custom Headers

  • User bearer token

Query Parameters

  • Space Guid

  • Provider Id

  • Only return shared endpoints

  • Only return managed endpoints

  • Return OpenAPI doc with list results. Possible values are ['provider', 'consumer']. Defaults to 'provider'

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints?space_guid={space_guid}'

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
        "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
        "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
        "metadata": {},
        "provider_id": "user-defined",
        "name": "test",
        "routes": [],
        "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
        "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
        "shared": false,
        "managed": true,
        "open_api_doc": {},
        "base_path": "/"
      }
    ]

Created a new user-defined endpoint

POST /v1/endpoints

Request

Custom Headers

  • User bearer token

Information about the new endpoint

  • curl -X POST   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "org_guid": "33521683-fd54-4cde-8e37-cdeaa7b0a80f",       "space_guid": "crn:v1:staging:public:api-gateway:global:a/e139a1ed8c1a770c128cc80cb07f426f:86164525-fd54-4cde-8e37-cdeaa7b0a80f::",       "name": "example",       "routes": [         "https://httpbin.org"       ],       "managed": false,       "metadata": {},       "open_api_doc": {}     }' 'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints'

Response

Status Code

  • Request was successful

Example responses
  • {
      "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
      "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
      "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
      "metadata": {},
      "provider_id": "user-defined",
      "name": "test",
      "routes": [],
      "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
      "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
      "shared": false,
      "managed": true,
      "open_api_doc": {},
      "base_path": "/"
    }

Get details for a given Endpoint

GET /v1/endpoints/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Space Guid

  • Provider Id

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints/{id}?space_guid={space_guid}'

Response

Status Code

  • Request was successful

Example responses
  • {
      "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
      "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
      "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
      "metadata": {},
      "provider_id": "user-defined",
      "name": "test",
      "routes": [],
      "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
      "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
      "shared": false,
      "managed": true,
      "open_api_doc": {},
      "base_path": "/"
    }

Update an endpoint

PUT /v1/endpoints/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Space Guid

  • Provider Id

Information about the new endpoint

  • curl -X PUT   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "org_guid": "33521683-fd54-4cde-8e37-cdeaa7b0a80f",       "space_guid": "crn:v1:staging:public:api-gateway:global:a/e139a1ed8c1a770c128cc80cb07f426f:86164525-fd54-4cde-8e37-cdeaa7b0a80f::",       "name": "example",       "routes": [         "https://httpbin.org"       ],       "managed": false,       "metadata": {},       "open_api_doc": {}     }' 'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints/{id}?space_guid={space_guid}'

Response

Status Code

  • Request was successful

Example responses
  • {
      "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
      "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
      "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
      "metadata": {},
      "provider_id": "user-defined",
      "name": "test",
      "routes": [],
      "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
      "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
      "shared": false,
      "managed": true,
      "open_api_doc": {},
      "base_path": "/"
    }

Delete an endpoint

DELETE /v1/endpoints/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Space Guid

  • curl -X DELETE   -H 'Authorization: Bearer <IAM token>'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints/{id}?space_guid={space_guid}'

Response

Status Code

  • Request was successful

No Sample Response

This method does not specify any sample responses.

Get the OpenAPI doc for a given Endpoint

GET /v1/endpoints/{id}/swagger

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Space Guid

  • Type of swagger to retrieve

    Allowable values: [json,yaml]

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints/{id}/swagger?space_guid={space_guid}'

Response

Status Code

  • Request was successful

Example responses
  • {
      "info": {
        "version": "1.0",
        "title": "example"
      },
      "x-ibm-configuration": {
        "assembly": {
          "execute": [
            {
              "invoke": {
                "target-url": "https://httpbin.org",
                "verb": "keep"
              }
            }
          ]
        }
      },
      "basePath": "/c636f62e-7d47-48bf-8e1d-b90c58762816",
      "paths": {
        "/": {
          "get": {
            "description": "Default get resource for endpoint",
            "responses": {
              "200": {
                "description": "A successful invocation response"
              }
            }
          }
        }
      }
    }

Execute actions for a given Endpoint

POST /v1/endpoints/{id}/actions

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Space Guid

  • Provider Id

Information about the requested action

  • curl -X POST   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "type": "manage",     }'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints/{id}/actions?space_guid={space_guid}?provider_id=user-defined'

Response

Status Code

  • Request was successful

Example responses
  • {
      "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
      "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
      "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
      "metadata": {},
      "provider_id": "user-defined",
      "name": "test",
      "routes": [],
      "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
      "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
      "shared": false,
      "managed": true,
      "open_api_doc": {},
      "base_path": "/"
    }

Get provider sorted summary about all Endpoints

GET /v1/endpoints/summary

Request

Custom Headers

  • User bearer token

Query Parameters

  • Space Guid

  • Return OpenAPI doc with list results. Possible values are ['provider', 'consumer']. Defaults to 'provider'

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/endpoints/summary?space_guid={space_guid}'

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "id": "cf-apps",
        "display_name": "Cloud Foundry",
        "metadata": {},
        "discoverable": true,
        "discovery_config": {
          "headers": [],
          "bridge_url": "https://foo.bar/bridges/example"
        },
        "endpoints": [
          {
            "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
            "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
            "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
            "metadata": {},
            "provider_id": "user-defined",
            "name": "test",
            "routes": [],
            "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
            "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
            "shared": false,
            "managed": true,
            "open_api_doc": {},
            "base_path": "/"
          }
        ]
      }
    ]

Get all subscriptions tied to a given artifact

GET /v1/subscriptions

Request

Custom Headers

  • User bearer token

Query Parameters

  • Artifact Id

  • Subscription type

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions?artifact_id={artifact_id}

Response

List of all subscriptions tied to a given artifact

Status Code

  • Request was successful

Example responses
  • [
      {
        "client_id": "62bc8a5f-480e-1e52-9229-daee77da1890",
        "secret_provided": true,
        "space_guid": "392ffa5f-433e-1e52-2139-fe131f183c90",
        "space_name": "space",
        "name": "example",
        "type": null,
        "metadata": {}
      }
    ]

Create a subscription for an artifact

POST /v1/subscriptions

Request

Custom Headers

  • User bearer token

Subscription

  • curl -X POST   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "client_id": "47712f48-fa6c-11e9-aad5-362b9e155667",       "client_secret": "be9f8a5c-fa6b-11e9-8f0b-362b9e155667",       "artifact_id": "62bc8a5f-480e-1e52-9229-daee77da1890"    }'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions'

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "client_id": "62bc8a5f-480e-1e52-9229-daee77da1890",
        "secret_provided": true,
        "space_guid": "392ffa5f-433e-1e52-2139-fe131f183c90",
        "space_name": "space",
        "name": "example",
        "type": null,
        "metadata": {}
      }
    ]

Get subscription for a given clientid

GET /v1/subscriptions/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Client Id

Query Parameters

  • Artifact Id

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions/{id}?artifact_id={artifact_id}

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "client_id": "62bc8a5f-480e-1e52-9229-daee77da1890",
        "secret_provided": true,
        "space_guid": "392ffa5f-433e-1e52-2139-fe131f183c90",
        "space_name": "space",
        "name": "example",
        "type": null,
        "metadata": {}
      }
    ]

Update a subscription

PUT /v1/subscriptions/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Client Id

Query Parameters

  • Artifact Id

Subscription

  • curl -X PUT   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "client_id": "47712f48-fa6c-11e9-aad5-362b9e155667",       "client_secret": "be9f8a5c-fa6b-11e9-8f0b-362b9e155667",       "artifact_id": "62bc8a5f-480e-1e52-9229-daee77da1890"    }'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions/{id}?artifact_id={artifact_id}'

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "client_id": "62bc8a5f-480e-1e52-9229-daee77da1890",
        "secret_provided": true,
        "space_guid": "392ffa5f-433e-1e52-2139-fe131f183c90",
        "space_name": "space",
        "name": "example",
        "type": null,
        "metadata": {}
      }
    ]

Delete a subscription

DELETE /v1/subscriptions/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Client Id

Query Parameters

  • Artifact Id

  • curl -X DELETE   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions/{id}?artifact_id={artifact_id}

Response

Status Code

  • Request was successful

No Sample Response

This method does not specify any sample responses.

Get artifact associated to a subscription

GET /v1/subscriptions/artifact

Request

Query Parameters

  • Artifact Id

  • Client Id

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions/{id}/artifact?artifact_id={artifact_id}

Response

Subscription artifact requested

Status Code

  • Request was successful

Example responses
  • {
      "open_api_doc": {
        "info": {
          "version": "1.0",
          "title": "example"
        },
        "x-ibm-configuration": {
          "assembly": {
            "execute": [
              {
                "invoke": {
                  "target-url": "https://httpbin.org",
                  "verb": "keep"
                }
              }
            ]
          }
        },
        "basePath": "/c636f62e-7d47-48bf-8e1d-b90c58762816",
        "paths": {
          "/": {
            "get": {
              "description": "Default get resource for endpoint",
              "responses": {
                "200": {
                  "description": "A successful invocation response"
                }
              }
            }
          }
        }
      },
      "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/"
    }

Update a subscription

PUT /v1/subscriptions/{id}/secret

Request

Custom Headers

  • Client id

Path Parameters

  • Client Id

Query Parameters

  • Artifact Id

Subscription Secret Request

  • curl -X PUT   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "client_secret": "be9f8a5c-fa6b-11e9-8f0b-362b9e155667",     }'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/subscriptions/{id}/secret?artifact_id={artifact_id}'

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "client_id": "62bc8a5f-480e-1e52-9229-daee77da1890",
        "secret_provided": true,
        "space_guid": "392ffa5f-433e-1e52-2139-fe131f183c90",
        "space_name": "space",
        "name": "example",
        "type": null,
        "metadata": {}
      }
    ]

Get details about all Endpoints

GET /v1/consumer/endpoints

Request

Custom Headers

  • User bearer token

Query Parameters

  • Org Guid

  • Provider Id

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/consumer/endpoints?org_guid={org_guid}

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
        "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
        "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
        "metadata": {},
        "provider_id": "user-defined",
        "name": "test",
        "routes": [],
        "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
        "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
        "shared": false,
        "managed": true,
        "open_api_doc": {},
        "base_path": "/"
      }
    ]

Get details about a given Endpoint

GET /v1/consumer/endpoints/{id}

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Org Guid

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/consumer/endpoints/{id}?org_guid={org_guid}

Response

Status Code

  • Request was successful

Example responses
  • {
      "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
      "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
      "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
      "metadata": {},
      "provider_id": "user-defined",
      "name": "test",
      "routes": [],
      "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
      "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
      "shared": false,
      "managed": true,
      "open_api_doc": {},
      "base_path": "/"
    }

Get the open_api_doc for a given Endpoint

GET /v1/consumer/endpoints/{id}/swagger

Request

Custom Headers

  • User bearer token

Path Parameters

  • Endpoint Id

Query Parameters

  • Org Guid

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/consumer/endpoints/{id}/swagger?org_guid={org_guid}

Response

Status Code

  • Request was successful

Example responses
  • {
      "info": {
        "version": "1.0",
        "title": "example"
      },
      "x-ibm-configuration": {
        "assembly": {
          "execute": [
            {
              "invoke": {
                "target-url": "https://httpbin.org",
                "verb": "keep"
              }
            }
          ]
        }
      },
      "basePath": "/c636f62e-7d47-48bf-8e1d-b90c58762816",
      "paths": {
        "/": {
          "get": {
            "description": "Default get resource for endpoint",
            "responses": {
              "200": {
                "description": "A successful invocation response"
              }
            }
          }
        }
      }
    }

Get provider sorted summary about all Endpoints

GET /v1/consumer/endpoints/summary

Request

Custom Headers

  • User bearer token

Query Parameters

  • Org Guid

  • curl -X GET   -H 'Authorization: Bearer <IAM token>'   -H 'Accept: application/json'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/consumer/endpoints/summary?org_guid={org_guid}

Response

Status Code

  • Request was successful

Example responses
  • [
      {
        "id": "cf-apps",
        "display_name": "Cloud Foundry",
        "metadata": {},
        "discoverable": true,
        "discovery_config": {
          "headers": [],
          "bridge_url": "https://foo.bar/bridges/example"
        },
        "endpoints": [
          {
            "artifact_id": "851c6ffe-7da6-41ab-a8fa-501bd0557001",
            "org_guid": "25370c08-fab8-11e9-8f0b-362b9e155667",
            "space_guid": "1beed7fc-fab8-11e9-8f0b-362b9e155667",
            "metadata": {},
            "provider_id": "user-defined",
            "name": "test",
            "routes": [],
            "managed_url": "https://gw.us-south.apigw.test.appdomain.cloud/api/abd7714cf04e470d102926d22f7a13fc3c3ff49c00e992f0e20119e61e914a67/",
            "alias_url": "https://497c007a.us-south.stage1.apiconnect.appdomain.cloud/",
            "shared": false,
            "managed": true,
            "open_api_doc": {},
            "base_path": "/"
          }
        ]
      }
    ]

Validate the imported open API doc

POST /v1/oai/validation

Request

Custom Headers

  • User bearer token

Open API doc to be validated

  • curl -X POST   -H 'Content-Type: application/json'   -H 'Accept: application/json'   -H 'Authorization: Bearer <IAM token>'   -d '{       "open_api_doc": {},     }'   'https://api.us-south.apigw.cloud.ibm.com/controller/v1/oai/validation'

Response

Status Code

  • Request was successful

No Sample Response

This method does not specify any sample responses.