> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/tutorials/create-your-own-collibra-rest-api-client.md).

# Create your own Collibra REST API client

In this tutorial you use the [OpenApi Generator](https://openapi-generator.tech/) to create a Python REST API client for the Collibra Core REST API.

Since the Collibra REST APIs adhere to the [OpenAPI](https://www.openapis.org) Specification (OAS), you can use an OAS API generator to get a client in your preferred programming language.

## Download the JSON specification

The OpenAPI Generator can read JSON specification files. You can download the JSON specification files for the Collibra REST APIs either from your Collibra Platform or from the Developer Portal.

{% tabs %}
{% tab title="From your Collibra Platform" %}
The API references are part of your Collibra Platform environment. You need to be logged in to access them.

To access the API documentation:

| User access   | API documentation                                                                                                                                     |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Sysadmin role | In the top-right corner of any Collibra page, click <img src="/files/r9yMxwz9IFK3FAqFh8cK" alt="" data-size="line"> and select **API documentation**. |
| All roles     | In a browser, go to https\://\<your\_collibra\_url>/docs/index.html.                                                                                  |

You can also consult the API documentation on the [Collibra Developer Portal](https://developer.collibra.com/api#apis).

{% stepper %}
{% step %}
In the **REST APIs** section, select the API you want to create a client for.
{% endstep %}

{% step %}
Click **Download the API schema** under the page title.
{% endstep %}

{% step %}
Save the file.
{% endstep %}
{% endstepper %}

<img src="/files/r3N1tWHOShhXE0J5eV4I" alt="" width="75%">
{% endtab %}

{% tab title="From the Developer Portal" %}
{% stepper %}
{% step %}
Go to the **API References** section of the REST homepage.
{% endstep %}

{% step %}
Select the API you want to create a client for.
{% endstep %}

{% step %}
Click **Download the API schema** under the page title.
{% endstep %}

{% step %}
Save the file.
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

## Install OpenAPI Generator

Follow the [OpenAPI Generator installation instructions](https://openapi-generator.tech/docs/installation) for your operating system and preferred installation mode.

To install the OpenAPI Generator on a Windows machine using [NPM](https://github.com/npm/cli), open a command line and execute the following command:

```bash
npm install @openapitools/openapi-generator-cli -g
```

## Generate the client

Follow the [OpenAPI Generator usage instructions](https://openapi-generator.tech/docs/usage#generate) to generate the API client.

To generate a Python client in a folder named **collibra-core**, with the package name **collibra\_core**:

1. In your command line, go to the directory with the JSON specification file.
2. Execute the following command:

   ```bash
   openapi-generator-cli generate -g python -i dgc-rest.json -o collibra-core --package-name collibra_core
   ```

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>If you don't provide a package name, it defaults to <strong>openapi_client</strong>.</p></div>

## Connect to your Collibra Platform

Use the sample [**main.py**](https://cdn.collibra.com/developer/main.py) to connect to your Collibra Platform:

{% stepper %}
{% step %}
Download the file to your project root directory: **collibra-core**, in this example.
{% endstep %}

{% step %}
Edit the file and provide the required values for the following variables:

```python
collibra_url = ""
username = ""
password = ""
```

{% endstep %}

{% step %}
In your command line, go to the project root folder.
{% endstep %}

{% step %}
Execute the following command to run **main.py**:

```bash
python .\main.py
```

{% endstep %}
{% endstepper %}

<i class="fa-chevrons-right">:chevrons-right:</i> The terminal displays the following information:

```bash
Platform version: <full_version>
Platform build number: <build_number>
You are connected as: <first_name> <last_name> (<user_name>)
You have access to <asset_count> business terms.
```

{% hint style="success" %}
If the command cannot be executed due to missing any of the dependencies listed in **requirements.txt**, [install the required dependencies](https://pip.pypa.io/en/stable/user_guide/#requirements-files).
{% endhint %}

## Next steps

To install the package, follow the Python [Installing Packages](https://packaging.python.org/tutorials/installing-packages/) tutorial, usually `pip install collibra_core` inside virtual environments or `pip install --user collibra_core`.

Generate clients for the other Collibra REST API applications.

{% hint style="info" %}
To successfully use the generated Collibra REST Import API package, you must manually update the files in **/\<package\_name>/modules** and replace any occurrence of `'\'` with `'\\'`.
{% endhint %}

## Additional resources

* Learn to [generate REST API clients with Collibra CLI](https://developer.collibra.com/tutorials/create-rest-client/).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.collibra.com/tutorials/create-your-own-collibra-rest-api-client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
