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

# REST Catalog

> How to configure Iceberg REST Catalog as a destination in Artie

## Required settings

* REST Catalog URI
* Authentication (Bearer token or OAuth2)
* Catalog name

## Databricks Unity catalog

To configure Unity catalog as a REST catalog, you will need to do the following:

* Enable [**external data access**](https://docs.databricks.com/aws/en/external-access/admin#external-data-access)
* Modify the service principal to have the following permissions:
  * `EXTERNAL USE SCHEMA`, `EXTERNAL USE LOCATION`
  * `USE CATALOG`, `USE SCHEMA`
  * `SELECT`
  * `MANAGE`, `CREATE SCHEMA`, `CREATE TABLE`, `MODIFY`, `WRITE VOLUME`

For example:

```sql theme={null}
GRANT EXTERNAL USE SCHEMA ON SCHEMA catalog_name.schema_name TO `artie@company.com`
```

Once this is done, you'll then want to grab:

1. REST Catalog URI (`https://{{DATABRICKS_INSTANCE_URL}}/api/2.1/unity-catalog/iceberg-rest`)
2. Catalog name

### Authentication

<Tabs>
  <Tab title="Bearer token">
    To generate a bearer token, you'll want to generate a personal access token:

    Go into your workspace and do the following:

    * Click on your username in the top bar and select Settings from the dropdown.
    * Click Developer
    * Click Access tokens then Generate new token
    * (Optional) Provide a description for the token and if you set expiration, make sure to note it down.

    <img src="https://mintcdn.com/artie/shyKuSs7RAFas242/assets/destinations/iceberg/pat.png?fit=max&auto=format&n=shyKuSs7RAFas242&q=85&s=591dfa155eaa53d18d6e05b9e609ed01" alt="Personal access token" style={{width: "800px", height: "auto"}} width="1376" height="568" data-path="assets/destinations/iceberg/pat.png" />
  </Tab>

  <Tab title="OAuth2 M2M">
    To generate an OAuth2 M2M token, you'll want to generate an OAuth2 token for your service principal:

    * Follow [this guide](https://docs.databricks.com/aws/en/admin/service-principals/oauth-m2m-tokens.html) to create an OAuth secret for your service principal
    * Put the token URL as `https://{{DATABRICKS_INSTANCE_URL}}/oidc/v1/token`
    * Put `all-apis` as the OAuth2 scope
  </Tab>
</Tabs>
