# OAA Operations

Use these REST API calls to manage and update custom providers and data sources with [Open Authorization API](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/oaa).

### Create Custom Provider

Creates a custom provider and returns the provider ID.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### List Custom Providers

Lists all configured custom providers.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Get Custom Provider by ID

Returns details for an individual custom provider.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Delete Custom Provider

Delete a custom provider by ID.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}" method="delete" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

## List Custom Provider Datasources

Return all data sources for a Custom Provider ID.

You can constrain large responses by adding a filter to the request query string. Include the operator (`eq`), and value, for example:

`CURL <VEZA_URL>/api/v1/providers/custom?filter=name eq "GitHub"&order_by=state`

{% hint style="info" %}
Veza expects that spaces in URLS are encoded as "`+`" (for example`?name+eq+"GitHub"&order_by=state`). Note that some libraries and clients will encode spaces as "`%2B`" by default, which will cause errors unless you override this behavior.
{% endhint %}

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Create Custom Provider Datasource

Register a new datasource for a custom provider. There can be more than one datasource for a single provider.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Get Datasource by ID

Returns details for a single datasource.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources/{data\_source\_id}" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Delete Custom Provider Datasource

Unbind a datasource from a custom provider, and delete it.

{% hint style="info" %}
You can also delete OAA datasources from the Veza web interface. On the **Integrations** page, find the OAA datasource in the list and click the action menu (⋮) to access the **Delete** option.
{% endhint %}

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources/{data\_source\_id}" method="delete" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Push Custom Provider Datasource

To push authorization metadata for a custom datasource, you can specify the source and provider IDs, and upload a payload with the entities and permissions in JSON format.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources/{data\_source\_id}:push" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

A warning is returned for any non-critical errors during payload processing. These can indicate incomplete or inaccurate data in the payload that do not prevent processing, but may warrant attention.

### Multipart Push Custom Provider Datasource

For large payloads that exceed 100 MB, use the multipart upload endpoint to upload the payload in chunks. See [Multipart Upload](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/oaa/rest-api/multipart-upload) for details, examples, and Python SDK usage.

```sh
POST /api/v1/providers/custom/{id}/datasources/{data_source_id}:parts
```

### Push Custom Provider Datasource CSV

For [CSV Upload Integrations](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/integrations/integrations/csv), this endpoint pushes CSV data to an existing datasource. Typically, you will first create the integration and define column mappings using the "Add Integration" flow in Veza.

CSV data must base64 encoded into the JSON body of the request.

```json
{
    "csv_data": "abc123="
}
```

```shell
CSV_PAYLOAD=$(cat my_app_data.csv | base64)
curl --location https://example.vezacloud.com/api/v1/providers/custom/40bdd318-d320-4574-be90-ca556d59889a/datasources/9bc29dc6-8cd0-4926-992e-7d720305ae2f:push_csv \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $VEZA_API_KEY" \
--data "{\"csv_data\": \"${CSV_PAYLOAD}\"}"
```

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources/{data\_source\_id}:push\_csv" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

#### Compression

The populated template can be compressed and encoded, for significantly reduced payload size.

* Specify the `compression_type`. Currently supported: `GZIP`.
* If compression is selected, Veza will expect the payload `json_data` as a compressed, base64-encoded string.

To compress using shell commands:

```shell
cat app_payload.json | gzip | base64 -o json_data.b64
```

> Size is typically not an issue when updating custom datasources. However, you may want to compress large payloads. The maximum body size is 100MB (compressed or uncompressed).

#### Escaping unsafe characters

Veza expects the populated template as a single JSON string, enclosed in the request body `json_data` field. Any `"`s and non-ASCII characters must be escaped.

To convert a template to JSON string using Python, the `json.dumps()` method could be used:

```python
payload = {"id": provider_id,
           "data_source_id": data_source_id,
           "json_data": json.dumps(template_contents)
           }
```

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources/{data\_source\_id}:push" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}/datasources/{data\_source\_id}:push\_csv" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Custom Provider Icons

You can optionally add an icon for your custom provider by uploading a PNG or SVG file (less than 64kb) as a base64-encoded string:

```bash
curl -X POST '{{VezaURL}}/api/v1/providers/custom/962d5eff-285c-4b08-a54e-400eead1e680:icon' \
-H "authorization: Bearer $API_KEY" \
-d '{"icon_base64": "PHN2ZyBmaWxsPSIjMDAwMDAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNjQgNjQiIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiPjxwYXRoIGQ9Ik0zMiA2QzE3LjY0MSA2IDYgMTcuNjQxIDYgMzJjMCAxMi4yNzcgOC41MTIgMjIuNTYgMTkuOTU1IDI1LjI4Ni0uNTkyLS4xNDEtMS4xNzktLjI5OS0xLjc1NS0uNDc5VjUwLjg1YzAgMC0uOTc1LjMyNS0yLjI3NS4zMjUtMy42MzcgMC01LjE0OC0zLjI0NS01LjUyNS00Ljg3NS0uMjI5LS45OTMtLjgyNy0xLjkzNC0xLjQ2OS0yLjUwOS0uNzY3LS42ODQtMS4xMjYtLjY4Ni0xLjEzMS0uOTItLjAxLS40OTEuNjU4LS40NzEuOTc1LS40NzEgMS42MjUgMCAyLjg1NyAxLjcyOSAzLjQyOSAyLjYyMy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3IDU3Ljk3MSAzMS4zOSA1OCAzMiA1OHpNMjkuNzg4IDU3LjljLTEuMjE3LS4xMDMtMi40MTEtLjI4OS0zLjU3NC0uNTU0QzI3LjM3OCA1Ny42MSAyOC41NzEgNTcuNzk3IDI5Ljc4OCA1Ny45eiIvPjwvc3ZnPg=="}'
```

#### Create Custom Provider Icon

Upload a custom icon to display for an OAA provider.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}:icon" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

#### Get Custom Provider Icon

Return the type and string-encoded icon for a custom provider.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}:icon" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom:icon" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}

#### Delete Custom Provider Icon

Delete the icon associated with an OAA provider.

{% openapi src="<https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media>" path="/api/v1/providers/custom/{id}:icon" method="delete" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-d0cc152d188a7ade16cd0e6e7f7f205786a7e186%2Fopenapi.yaml?alt=media)
{% endopenapi %}
