# RudderStack Tracking Plan API


{{< danger >}}
This API is deprecated. See [Data Catalog API]({{< ref "api/data-catalog-api/" >}}) to create and manage your Tracking Plans programmatically.
{{< /danger >}}

The [Tracking plan API](https://documenter.getpostman.com/view/16242548/TzeWFT6D#7df289e7-8758-4ec0-a86e-3aa08bd3260e) lets you programmatically create and manage your [Tracking Plans]({{< ref "data-governance/tracking-plans/_index.md" >}}). You can use the API to:

- Create/update/fetch Tracking Plans associated with your workspace
- Define Tracking Plan rules
- Create/update Tracking Plan configurations for a particular source
- Link and unlink a source/events to a Tracking Plan
- Delete a Tracking Plan

## Prerequisites

- Set up a source-destination connection in RudderStack. See the [Quickstart]({{< ref "data-pipelines/event-stream/quickstart/" >}}) guide for detailed steps.
- Generate a [workspace-level Service Access Token]({{< ref "access-management/service-access-tokens.md#generate-service-access-token" >}}) in the RudderStack dashboard with **Admin** permissions to authenticate the API.

{{< image src="images/access-management/permissions/legacy/viewer.webp" alt="workspace-level Service Access Token with Admin permission" >}}

## API authorization

The Tracking Plan API uses **Basic Authentication** for authenticating all requests.

If you're using Postman, authenticate the API by including an empty string (`""`) as the username and your [workspace-level Service Access Token](#prerequisites) as the password in the **Authorization** tab.

You can also pass your Service Access Token in the authorization header directly:

```bash
Authorization: Basic {Base64Encoded(:<SERVICE_ACCESS_TOKEN>)}
```

An example is shown below:

- Username: `""` (empty string)
- Service Access Token: `<SERVICE_ACCESS_TOKEN>`
- Header: `Basic {Base64Encoded(:<SERVICE_ACCESS_TOKEN>)}`

{{< tip >}}
Verify that the Service Access Token is valid if you get an **Invalid Authorization Header** error.
{{< /tip >}}

## Base URL

Use the base URL for your API requests depending on your region:

{{< tabs tabTotal="2" >}}
{{% tab tabName="Standard" %}}
```text
https://api.rudderstack.com
```
{{% /tab %}}
{{% tab tabName="EU-Standard" %}}
```text
https://api.eu.rudderstack.com
```
{{% /tab %}}
{{< /tabs >}}

## Tracking plan API usage

| Tracking plan API | Description       | 
| :------------------ | :------------ | 
| [Tracking Plans](https://documenter.getpostman.com/view/16242548/TzeWFT6D#2a5b999c-b417-4622-ad13-d212e4e211d1)    |    This section contains all the requests and the examples related to: <br /><br /> <ul><li>Creating a Tracking Plan</li><li>Fetching a single or all Tracking Plans</li><li>Updating a Tracking Plan</li><li>Upserting a Tracking Plan</li><li>Deleting a Tracking Plan</li></ul> | 
| [Tracking Plan Rules](https://documenter.getpostman.com/view/16242548/TzeWFT6D#dfa3156f-216f-4399-bd5d-c57e077ba406)      |  This section contains all the requests and the examples related to setting the Tracking Plan rules like: <br /><br /> <ul><li>Creating events</li><li>Fetching all events</li><li>Fetching all events linked to a Tracking Plan</li><li>Updating events by ID</li><li>Linking or unlinking events from a Tracking Plan</li><li>Deleting events</li></ul>It also contains upsert and deletion requests for all non-track rules (applicable for `identify`, `group`, `page`, and `screen` events) like:<br /><br /><ul><li>Creating or updating a non-track rule for a Tracking Plan</li><li>Deleting a non-track rule mapped to a Tracking Plan</li></ul>   | 
| [Source Tracking Plan Connections](https://documenter.getpostman.com/view/16242548/TzeWFT6D#4b74ffd2-de44-43c9-b2a4-2d65e4fb61c9)  | This section contains all the requests and the examples related to Tracking Plan configurations like: <br /><br /> <ul><li>Creating or updating Tracking Plan configurations for a source ID</li><li>Fetching all Tracking Plan configurations by source ID</li><li>Fetching all sources connected to a Tracking Plan</li><li>Linking or unlinking a source to a Tracking Plan</li></ul> |

### Event structure

To perform the Tracking Plan validation successfully, your event payload structure must conform to the standard [RudderStack event spec]({{< ref "event-spec/standard-events/_index.md" >}}).

See the following sample event payloads for more information:

- [Identify]({{< ref "event-spec/standard-events/identify.md#sample-payload" >}})
- [Page]({{< ref "event-spec/standard-events/page.md#sample-payload" >}})
- [Screen]({{< ref "event-spec/standard-events/screen.md#sample-payload" >}})
- [Track]({{< ref "event-spec/standard-events/track.md#sample-payload" >}})
- [Group]({{< ref "event-spec/standard-events/group.md#sample-payload" >}})

You can also see the example request in the [Create Tracking Plan API](https://documenter.getpostman.com/view/16242548/TzeWFT6D#7eec6c80-64e8-444d-bbe4-bd63fb1d886a) for the event formatting structure.

<br />
