This predefined role contains
the permissions required to list subject versions. To see the exact permissions that are
required, expand theRequired permissionssection:
Required permissions
The following permissions are required to list subject versions:
Grant the following permission on the parent subject:managedkafka.versions.list
A list of schema registries in your project is displayed.
Click the name of the schema registry where your subject is located.
TheSchema registry detailspage opens. The information displayed on
this page is explained in theSchema registry page detailssection.
From the list of schema subjects inSubjects in this schema registry,
click the subject for which you want to list the versions.
TheSubject detailspage opens, which lists all the versions of the subject.
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.
[[["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 subject versions\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 versions of a subject within a specific schema registry\nin your project.\n\nThis document shows you how to list subject versions 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 subject versions,\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.\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 subject versions. 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 subject versions:\n\n- Grant the following permission on the parent subject: ` ``managedkafka.versions.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 subject versions\n--------------------------\n\nTo list all versions of a subject in a specific schema registry 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 where your subject is located. 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\n3. From the list of schema subjects in **Subjects in this schema registry** , click the subject for which you want to list the versions.\n\n The **Subject details** page opens, which lists all the versions of the subject.\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 subject versions, make a `GET`\nrequest to the\n[`projects.locations.schemaRegistries.subjects.versions.list`](/managed-service-for-apache-kafka/docs/reference/rest/v1/projects.locations.schemaRegistries.subjects.versions/list)\nmethod. \n\n```bash\nGET https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/REGISTRY_ID/subjects/SUBJECT_ID/versions\nAuthorization: Bearer $(gcloud auth application-default print-access-token)\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your Google Cloud project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the Google Cloud region where the schema registry is located.\n- \u003cvar translate=\"no\"\u003eREGISTRY_ID\u003c/var\u003e: the ID of your schema registry.\n- \u003cvar translate=\"no\"\u003eSUBJECT_ID\u003c/var\u003e: the ID of the subject.\n\nExample: \n\n```bash\nGET https://managedkafka.googleapis.com/v1main/projects/test-project/locations/us-central1/schemaRegistries/test_registry/subjects/test_subject/versions\nAuthorization: Bearer $(gcloud auth application-default print-access-token)\n```\n\nOr with a context: \n\n```bash\nGET https://managedkafka.googleapis.com/v1main/projects/test-project/locations/us-central1/schemaRegistries/test_registry/contexts/test_context/subjects/test_subject/versions\nAuthorization: Bearer $(gcloud auth application-default print-access-token)\n```\n\nWhere:\n\n- `test-project` is your Google Cloud project ID.\n- `us-central1` is the Google Cloud region where the schema registry is located.\n- `test_registry` is the ID of your schema registry.\n- `test_context` is the ID of the context.\n- `test_subject` is the ID of the subject.\n\nIf the request is successful, the API returns a `200 OK`\nstatus code. The response body contains a JSON array of subject versions.\n\nThe following is a sample successful response: \n\n```json\n{\n \"versions\": [\n {\n \"name\": \"projects/test-project/locations/us-central1/schemaRegistries/test_registry/subjects/test_subject/versions/1\",\n \"revisionId\": \"1a2b3c4d\",\n \"schemaId\": \"S12345\",\n \"createTime\": \"2024-07-15T12:00:00Z\",\n \"revisionCreateTime\": \"2024-07-15T12:00:00Z\"\n },\n {\n \"name\": \"projects/test-project/locations/us-central1/schemaRegistries/test_registry/subjects/test_subject/versions/2\",\n \"revisionId\": \"5e6f7g8h\",\n \"schemaId\": \"S67890\",\n \"createTime\": \"2024-07-16T14:30:00Z\",\n \"revisionCreateTime\": \"2024-07-16T14:30:00Z\"\n }\n ]\n}\n```\n\nFor more information, see the\n[`projects.locations.schemaRegistries.subjects.versions.list`](/managed-service-for-apache-kafka/docs/reference/rest/v1/projects.locations.schemaRegistries.subjects.versions/list) method documentation.\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Learn more about schema registry](/managed-service-for-apache-kafka/docs/schema-registry)\n\n- [View a schema registry](/managed-service-for-apache-kafka/docs/schema-registry/view-schema-registry)\n\n- [View a schema subject](/managed-service-for-apache-kafka/docs/schema-registry/view-schema-subject)\n\n*Apache Kafka® is a registered\ntrademark of The Apache Software Foundation or its affiliates in the United\nStates and/or other countries.*"]]