[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Create API supply chain dependencies\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\nYou can create a dependency between APIs, API versions, and API operations in API hub. The high-level process to create a dependency is as follows:\n\n1. Find two APIs that may have operations that may be dependent. The operations may be in [registered APIs](./manage-apis#register-an-api) or [external APIs](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.externalApis).\n2. Determine which API is the supplier and which is the consumer. As discussed previously, the consumer invokes the supplier.\n3. Use the Google Cloud console or the [Create dependency API](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/create) to create the dependency between the supplier and consumer.\n\nCreate a dependency\n-------------------\n\nYou can create a dependency in the console or with the REST API. \n\n### Console\n\nTo create a dependency using the Google Cloud console, do the following:\n\n1. In the Google Cloud console, go to the **API supply chain** page in **API hub**.\n\n [Go to API hub](https://console.cloud.google.com/apigee/api-hub/dependencies)\n2. Click **Create dependency** and provide the following inputs in the **Create a new dependency** page.\n3. Under **General details** , do the following:\n 1. **Specify unique ID** : (Optional) The identifier of the dependency. If not provided, a system-generated ID will be used. **Note:** Dependency ID must be 4-500 characters long and can contain only uppercase letters (A-Z), lowercase letters (a-z), numbers (0-9), and hyphens (-). The ID forms the last part of the API resource name: `projects/`\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/dependencies/`\u003cvar translate=\"no\"\u003eDEPENDENCY_ID\u003c/var\u003e.\n 2. **Description**: (Optional) A brief description of the dependency.\n 3. Click **Continue**.\n4. Under **Select supplier resource** , do the following:\n 1. **Resource type:** Select **Operation** as the supplier resource type.\n 2. **Supplier API:** Select the API that supplies the operation.\n 3. **Version:** Select the API version of the supplier API that provides the operation.\n 4. **Operation:** Select the operation that is supplied to the consumer. For example: `GET-/items`.\n 5. Click **Continue**.\n | **Note:** To use external APIs to create dependencies, you must use the [Dependencies API](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/create). For more information, see the **REST API** tab.\n5. Under **Select consumer resource** , do the following:\n 1. **Resource type:** Select **Operation** as the consumer resource type.\n 2. **Consumer API:** Select the API that consumes the operation.\n 3. **Version:** Select the API version of the consumer API that consumes the operation.\n 4. **Operation:** Select the operation that is consumed by the supplier. For example: `GET-/categories`.\n 5. Click **Continue**.\n6. Optionally, provide values for any user-defined attributes that were defined in Settings.\n7. Click **Create** . The new dependency appears in the **API supply chain** page.\n\n### REST API\n\nTo create a new dependency using the [Create a dependency](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/create) API, use the following command: \n\n```\n curl -X POST 'https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/dependencies?dependency_id=DEPENDENCY_ID' \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H 'Content-Type: application/json' \\\n --d '{\n \"description\": \"DESCRIPTION\",\n \"supplier\": {\n // Specify one of the following:\n \"operation_resource_name\": RESOURCE_NAME\n // OR\n \"external_api_resource_name: RESOURCE_NAME\"\n },\n \"consumer\": {\n // Specify one of the following:\n \"operation_resource_name\": RESOURCE_NAME\n // OR\n \"external_api_resource_name: RESOURCE_NAME\"\n }\n }'\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eHUB_PROJECT\u003c/var\u003e: The name of your API hub host project. The host project was selected when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eHUB_LOCATION\u003c/var\u003e: The location of the host project. The location was chosen when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eDEPENDENCY_ID\u003c/var\u003e: (Optional) The identifier of the dependency. If not provided, a system-generated ID will be used. **Note:** The ID must be 4-500 characters, and valid characters are `/[A-Z][a-z][0-9]-/.` The ID is the last component of the fully qualified, unique API resource name, which is in the format: `projects/`\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/dependencies/`\u003cvar translate=\"no\"\u003eDEPENDENCY_ID\u003c/var\u003e\n- \u003cvar translate=\"no\"\u003eDESCRIPTION\u003c/var\u003e: (Optional) A brief description of the dependency.\n- \u003cvar translate=\"no\"\u003eRESOURCE_NAME\u003c/var\u003e: (Required) Either the resource name of an operation in API hub or an external API, depending on\n which attribute you specify.\n\n Operation resource names follow this format: `projects/`\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/apis/`\u003cvar translate=\"no\"\u003eAPI\u003c/var\u003e`/versions/`\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e`/operations/`\u003cvar translate=\"no\"\u003eOPERATION\u003c/var\u003e\n\n Operation resource example: `\"projects/myproject/locations/us-central1/apis/payments-api/versions/locationv1/operations/getlocation\"`.\n\n External API resource names follow this format: `projects/`\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/externalApis/`\u003cvar translate=\"no\"\u003eEXTERNAL_API\u003c/var\u003e\n\n\n External API resource example: `\"projects/myproject/locations/us-central1/externalApis/petstore\"`.\n\nExample: \n\n```\n curl -X POST 'https://apihub.googleapis.com/v1/projects/myproject/locations/us-central1/dependencies?dependency_id=user-to-pet' \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H 'Content-Type: application/json' \\\n --d '{\n \"description\": \"Dependency from user to pet API\",\n \"consumer\": {\n \"operation_resource_name\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/paymentv1/operations/createuser\"\n },\n \"supplier\": {\n \"operation_resource_name\": \"projects/myproject/locations/us-central1/apis/pet-api/versions/petstorev1/operations/addpet\"\n }\n }'\n```\n\nSample response: \n\n```\n{\n \"name\": \"projects/myproject/locations/us-central1/dependencies/user-to-pet\",\n \"consumer\": {\n \"displayName\": \"POST - /v2/user\",\n \"operationResourceName\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/createuser\"\n },\n \"supplier\": {\n \"displayName\": \"POST - /v2/pet\",\n \"operationResourceName\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/addpet\"\n },\n \"state\": \"VALIDATED\",\n \"description\": \"Dependency from user to pet API\",\n \"discoveryMode\": \"MANUAL\",\n \"createTime\": \"2024-04-17T19:33:31.664226Z\",\n \"updateTime\": \"2024-04-17T19:33:31.664226Z\"\n }\n```\n\nWhat's next?\n------------\n\n- Learn about how to [manage dependencies](./manage-dependencies)."]]