This predefined role contains
the permissions required to list subjects. To see the exact permissions that are
required, expand theRequired permissionssection:
Required permissions
The following permissions are required to list subjects:
Grant the following permission on the parent schema registry or context:managedkafka.googleapis.com/subjects.list
A list of schema registries in your project is displayed.
Click the name of the schema registry whose details you want to view.
TheSchema registry detailspage opens. The information displayed on
this page is explained in theSchema registry page detailssection.
REST
The request must be authenticated with an access token in theAuthorizationheader. To obtain an access token for the current
Application Default Credentials:gcloud auth application-default print-access-token.
GET https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/REGISTRY_ID/contexts/CONTEXT_ID/subjects?subjectPrefix=SUBJECT_PREFIXAuthorization: Bearer $(gcloud auth application-default print-access-token)
Replace the following:
PROJECT_ID(required): your Google Cloud project ID.
LOCATION(required): the Google Cloud region where the schema registry is located.
REGISTRY_ID(required): the ID of your schema registry.
CONTEXT_ID(optional): the ID of the context (if listing subjects within a context).
SUBJECT_PREFIX(optional): the context to filter the subjects by, in the format
of:.{context}:. If unset, all subjects in the registry are returned.
If set to an empty string, lists subjects in the default context.
If the request is successful, the API returns a200 OKstatus code. The response body contains a JSON array of subject names.
The following is a sample successful response of subjects in a JSON array
for the default context:
[[["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-09-04 UTC."],[],[],null,["# List subjects\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nYou can list the subjects within a specific schema registry or context\nin your project.\n\nThis document shows you how to list subjects using the\nGoogle Cloud console or the Managed Kafka API.\n\n### Required roles and permissions\n\n\nTo get the permissions that\nyou need to list subjects,\n\nask your administrator to grant you the\n\n\n[Managed Kafka Schema Registry Viewer](/iam/docs/roles-permissions/managedkafka#managedkafka.schemaRegistryViewer) (`roles/managedkafka.schemaRegistryViewer`)\nIAM role on your schema registry or context.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to list subjects. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to list subjects:\n\n- Grant the following permission on the parent schema registry or context: ` ``managedkafka.googleapis.com/subjects.list`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nFor more information about predefined roles, see the\n[Managed Service for Apache Kafka predefined roles](/managed-service-for-apache-kafka/docs/access-control#predefined-roles).\n\nList your subjects\n------------------\n\nTo list all subjects in a specific schema registry or context within your project,\nfollow these steps. \n\n### Console\n\n1. In the Google Cloud console, go to the **Schema registries** page.\n\n [Go to schema registry](https://console.cloud.google.com/managedkafka/schemaRegistries)\n\n A list of schema registries in your project is displayed.\n2. Click the name of the schema registry whose details you want to view. The **Schema registry details** page opens. The information displayed on\n this page is explained in the [Schema registry page details](/managed-service-for-apache-kafka/docs/schema-registry/view-schema-registry#schema-registry-page-details) section.\n\n\u003cbr /\u003e\n\n### REST\n\nThe request must be authenticated with an access token in the\n`Authorization` header. To obtain an access token for the current\nApplication Default Credentials:\n[`\ngcloud auth application-default print-access-token`](/sdk/gcloud/reference/auth/application-default/print-access-token).\n\n\u003cbr /\u003e\n\nTo list subjects directly under a schema registry, make a `GET`\nrequest to the specific URI using the [`projects.locations.schemaRegistries.schemas.subjects.list`](/managed-service-for-apache-kafka/docs/reference/rest/v1/projects.locations.schemaRegistries.schemas.subjects/list)\nmethod for the default context. \n\n```bash\nGET https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/REGISTRY_ID/subjects\nAuthorization: Bearer $(gcloud auth application-default print-access-token)\n```\n\nTo list subjects under a context within a schema registry, make a `GET`\nrequest to the specific URI using the [`projects.locations.schemaRegistries.contexts.schemas.subjects.list`](/managed-service-for-apache-kafka/docs/reference/rest/v1/projects.locations.schemaRegistries.contexts.schemas.subjects/list) method: \n\n```bash\nGET https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/REGISTRY_ID/contexts/CONTEXT_ID/subjects?subjectPrefix=SUBJECT_PREFIX\nAuthorization: Bearer $(gcloud auth application-default print-access-token)\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e (required): your Google Cloud project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e (required): the Google Cloud region where the schema registry is located.\n- \u003cvar translate=\"no\"\u003eREGISTRY_ID\u003c/var\u003e (required): the ID of your schema registry.\n- \u003cvar translate=\"no\"\u003eCONTEXT_ID\u003c/var\u003e (optional): the ID of the context (if listing subjects within a context).\n- \u003cvar translate=\"no\"\u003eSUBJECT_PREFIX\u003c/var\u003e (optional): the context to filter the subjects by, in the format of `:.{context}:`. If unset, all subjects in the registry are returned. If set to an empty string, lists subjects in the default context.\n\nIf the request is successful, the API returns a `200 OK`\nstatus code. The response body contains a JSON array of subject names.\n\nThe following is a sample successful response of subjects in a JSON array\nfor the default context: \n\n```json\n[\n \"orders-topic-key\",\n \"orders-topic-value\",\n \"user-profile-event\"\n]\n```\n\nSubjects in non-default contexts are returned in the format\n`:.context:subject`.\n\nFor more information, see the\n[`projects.locations.schemaRegistries.contexts.schemas.subjects.list`](/managed-service-for-apache-kafka/docs/reference/rest/v1/projects.locations.schemaRegistries.contexts.schemas.subjects/list) method documentation.\n\n\u003cbr /\u003e\n\n*Apache Kafka® is a registered\ntrademark of The Apache Software Foundation or its affiliates in the United\nStates and/or other countries.*"]]