> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve a Topic

> Get a topic by ID or fully qualified name

# Retrieve a Topic

Get a single topic by its unique ID or fully qualified name.

## Get by ID

**id** `string` *required*

UUID of the topic to retrieve.

**fields** `string`

Comma-separated list of fields to include, for example `owners,tags,followers,votes,extension,domains,sourceHash`.

**include** `string` (default: non-deleted)

Include `all`, `deleted`, or `non-deleted` entities.

## Get by Fully Qualified Name

Use `GET /v1/topics/name/{fqn}` to retrieve by fully qualified name.

**fqn** `string` *required*

Fully qualified name of the topic, for example `sample_kafka.address_book`.

**fields** `string`

Comma-separated list of fields to include: `owners`, `tags`, `followers`, `votes`, `extension`, `domains`, `sourceHash`.

**include** `string` (default: non-deleted)

Include `all`, `deleted`, or `non-deleted` entities.

```python GET /v1/topics/{id} theme={null}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
    AuthProvider,
    OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
    OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.data.topic import Topic

metadata = OpenMetadata(
    OpenMetadataConnection(
        hostPort="https://your-company.open-metadata.org/api",
        authProvider=AuthProvider.openmetadata,
        securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
    )
)

# Get by ID
topic = metadata.get_by_id(entity=Topic, entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016")
print(f"{topic.fullyQualifiedName.root}: {topic.description.root}")

# Get by ID with fields
topic = metadata.get_by_id(
    entity=Topic,
    entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016",
    fields=["owners", "tags", "messageSchema"]
)

# Get by fully qualified name
topic = metadata.get_by_name(entity=Topic, fqn="sample_kafka.address_book")

# Get by name with fields
topic = metadata.get_by_name(
    entity=Topic,
    fqn="sample_kafka.address_book",
    fields=["owners", "tags", "domains"]
)
```

```java GET /v1/topics/{id} theme={null}
import org.openmetadata.schema.entity.data.Topic;

// client is an initialized OpenMetadataClient.

// Get by ID
Topic topic = client.topics().get("0a021819-982e-4ee4-a5a2-4af30eaa3016");

// Get by ID with fields
Topic topicWithFields = client.topics().get(
    "0a021819-982e-4ee4-a5a2-4af30eaa3016",
    "owners,tags,messageSchema"
);

// Get by fully qualified name
Topic topicByName = client.topics().getByName("sample_kafka.address_book");

// Get by name with fields
Topic topicByNameWithFields = client.topics().getByName(
    "sample_kafka.address_book",
    "owners,tags,domains"
);
```

```bash GET /v1/topics/{id} theme={null}
# Get by ID
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016" \
  -H "Authorization: Bearer {access_token}"

# Get by ID with fields
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016?fields=owners,tags,domains" \
  -H "Authorization: Bearer {access_token}"

# Get by fully qualified name
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book" \
  -H "Authorization: Bearer {access_token}"

# Get by name with fields
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book?fields=owners,tags,domains" \
  -H "Authorization: Bearer {access_token}"
```

```json Response theme={null}
{
  "id": "0a021819-982e-4ee4-a5a2-4af30eaa3016",
  "name": "address_book",
  "fullyQualifiedName": "sample_kafka.address_book",
  "description": "All Protobuf record related events gets captured in this topic",
  "version": 0.1,
  "updatedAt": 1769982663546,
  "updatedBy": "admin",
  "service": {
    "id": "469ef25e-9bdf-4d5f-8553-eb0ce8581f30",
    "type": "messagingService",
    "name": "sample_kafka",
    "fullyQualifiedName": "sample_kafka",
    "displayName": "sample_kafka",
    "deleted": false
  },
  "serviceType": "Kafka",
  "messageSchema": {
    "schemaText": "syntax = \"proto2\";\npackage tutorial;\nmessage Person { ... }",
    "schemaType": "Protobuf",
    "schemaFields": [
      {
        "name": "AddressBook",
        "dataType": "RECORD",
        "fullyQualifiedName": "sample_kafka.address_book.AddressBook",
        "children": []
      }
    ]
  },
  "partitions": 1,
  "cleanupPolicies": ["delete"],
  "replicationFactor": 1,
  "maximumMessageSize": 1,
  "retentionSize": -1,
  "href": "http://localhost:8585/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016",
  "deleted": false,
  "owners": [],
  "tags": [],
  "followers": [],
  "votes": {
    "upVotes": 0,
    "downVotes": 0,
    "upVoters": [],
    "downVoters": []
  },
  "domains": []
}
```

***

## Returns

Returns a topic object with all requested fields populated.

## Response

**id** `string`

Unique identifier for the topic (UUID format).

**name** `string`

Topic name.

**fullyQualifiedName** `string`

Fully qualified name in format `service.topicName`.

**displayName** `string`

Human-readable display name.

**description** `string`

Description of the topic in Markdown format.

**service** `object`

Reference to the parent messaging service.

**properties**

**id** `string`

UUID of the messaging service.

**type** `string`

Type of entity (always `messagingService`).

**name** `string`

Name of the messaging service.

**fullyQualifiedName** `string`

Fully qualified name of the messaging service.

**messageSchema** `object`

Schema definition for messages. Only included when `fields` contains `messageSchema`.

**properties**

**schemaType** `string`

Type of schema, for example `Avro`, `Protobuf`, `JSON`.

**schemaText** `string`

The schema definition text.

**schemaFields** `array`

Parsed schema fields.

**serviceType** `string`

Type of messaging service, for example Kafka, Redpanda, Kinesis.

**version** `number`

Version number for the entity.

**owners** `array`

List of owners. Only included when `fields` contains `owners`.

**tags** `array`

Classification tags. Only included when `fields` contains `tags`.

**domains** `array`

Domain assignments. Only included when `fields` contains `domains`.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to view this topic |
| `404` | `NOT_FOUND` | Topic with given ID or FQN does not exist |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.