> ## 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.

# Import & Export Messaging Services

> Import and export messaging service metadata as CSV

# Import & Export

Export messaging service metadata (topics, owners, tags) to CSV and import changes back. Supports both synchronous and asynchronous operations.

## Export to CSV

`GET /v1/services/messagingServices/name/{fqn}/export`

<ParamField path="fqn" type="string" required>
  Fully qualified name of the messaging service (e.g., `sample_kafka`).
</ParamField>

## Export Async

`GET /v1/services/messagingServices/name/{fqn}/exportAsync`

Returns a job ID for large exports that can be polled for completion.

## Import from CSV

`PUT /v1/services/messagingServices/name/{fqn}/import`

<ParamField path="fqn" type="string" required>
  Fully qualified name of the messaging service.
</ParamField>

<ParamField query="dryRun" type="boolean" default="true">
  If `true`, validates the CSV without applying changes. Set to `false` to apply.
</ParamField>

## Import Async

`PUT /v1/services/messagingServices/name/{fqn}/importAsync`

For large imports, use the async variant which returns a job ID.

<RequestExample dropdown>
  ```python GET /v1/services/messagingServices/name/{fqn}/export theme={null}
  import requests

  base_url = "https://your-company.open-metadata.org/api"
  headers = {"Authorization": "Bearer your-jwt-token"}

  # Synchronous export
  response = requests.get(
      f"{base_url}/v1/services/messagingServices/name/sample_kafka/export",
      headers=headers
  )
  csv_data = response.text
  print(csv_data)

  # Async export
  response = requests.get(
      f"{base_url}/v1/services/messagingServices/name/sample_kafka/exportAsync",
      headers=headers
  )
  job = response.json()
  print(f"Export job: {job}")

  # Synchronous import (dry run first)
  response = requests.put(
      f"{base_url}/v1/services/messagingServices/name/sample_kafka/import",
      params={"dryRun": True},
      headers={**headers, "Content-Type": "text/plain"},
      data=csv_data
  )
  print(f"Dry run result: {response.json()}")

  # Apply the import
  response = requests.put(
      f"{base_url}/v1/services/messagingServices/name/sample_kafka/import",
      params={"dryRun": False},
      headers={**headers, "Content-Type": "text/plain"},
      data=csv_data
  )

  # Async import
  response = requests.put(
      f"{base_url}/v1/services/messagingServices/name/sample_kafka/importAsync",
      params={"dryRun": False},
      headers={**headers, "Content-Type": "text/plain"},
      data=csv_data
  )
  ```

  ```java GET /v1/services/messagingServices/name/{fqn}/export theme={null}
  import org.openmetadata.sdk.fluent.MessagingServices;

  // Synchronous export
  String csvData = MessagingServices.exportCsv("sample_kafka")
      .execute();

  // Async export
  String jobId = MessagingServices.exportCsv("sample_kafka")
      .async()
      .execute();

  // Synchronous import (dry run)
  String result = MessagingServices.importCsv("sample_kafka")
      .withData(csvData)
      .dryRun(true)
      .execute();

  // Apply import
  String result = MessagingServices.importCsv("sample_kafka")
      .withData(csvData)
      .dryRun(false)
      .execute();

  // Async import
  String jobId = MessagingServices.importCsv("sample_kafka")
      .withData(csvData)
      .dryRun(false)
      .async()
      .execute();
  ```

  ```bash GET /v1/services/messagingServices/name/{fqn}/export theme={null}
  # Export to CSV
  curl "{base_url}/api/v1/services/messagingServices/name/sample_kafka/export" \
    -H "Authorization: Bearer {access_token}"

  # Async export
  curl "{base_url}/api/v1/services/messagingServices/name/sample_kafka/exportAsync" \
    -H "Authorization: Bearer {access_token}"

  # Import CSV (dry run)
  curl -X PUT "{base_url}/api/v1/services/messagingServices/name/sample_kafka/import?dryRun=true" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: text/plain" \
    --data-binary @service_export.csv

  # Import CSV (apply)
  curl -X PUT "{base_url}/api/v1/services/messagingServices/name/sample_kafka/import?dryRun=false" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: text/plain" \
    --data-binary @service_export.csv

  # Async import
  curl -X PUT "{base_url}/api/v1/services/messagingServices/name/sample_kafka/importAsync?dryRun=false" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: text/plain" \
    --data-binary @service_export.csv
  ```
</RequestExample>

<ResponseExample>
  ```json Response (Export) theme={null}
  "name,displayName,description,owner,tags,domain\norder_events,Order Events,Events for order processing,team:data-engineering,Tier.Tier1,,"
  ```
</ResponseExample>

***

## Returns

**Export** returns CSV text with headers and rows for each child entity.

**Import** returns a summary of changes applied (or validation results for dry run).

***

## Error Handling

| Code  | Error Type     | Description                                     |
| ----- | -------------- | ----------------------------------------------- |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token         |
| `403` | `FORBIDDEN`    | User lacks permission for import/export         |
| `404` | `NOT_FOUND`    | Messaging service with given FQN does not exist |
| `400` | `BAD_REQUEST`  | Invalid CSV format or content                   |
