> For the complete documentation index, see [llms.txt](https://docs.podigee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podigee.com/api-reference/rest-api/decide-which-system-leads.md). Agents can also search and read this documentation through its [MCP server](https://docs.podigee.com/~gitbook/mcp).

# Decide which system leads

Choose which system holds the original of each episode field before you build a REST API integration.

Before you build an integration, decide which system leads: Podigee or your own system, for example a content management system (CMS). The system that leads holds the original of the data. The other system holds a copy and does not change it. This decision controls the credential that you need, the requests that you send, and the errors that can occur.

## How it works

Two properties of the REST API v1 limit your choice:

* Podigee does not call your system when something changes. The REST API has no webhooks. A system that needs a change must read the state. See [Detect changes](https://docs.podigee.com/api-reference/rest-api.md#detect-changes).
* An update replaces the stored values. `PUT /episodes/{episode_id}` does not check if the episode changed after your last read. It reports a conflict only when the transcript or the recording changes during the update itself. See [Episode errors](https://docs.podigee.com/api-reference/rest-api/podcasts-and-episodes.md#episode-errors).

As a result, an integration is reliable only when each field has one system that leads.

## The three models

| Model                               | What your system does                                                                | Credential                                                                                   |
| ----------------------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| Podigee leads                       | It reads episodes and shows them. It sends no write requests.                        | None for the feed of a public podcast. A REST API token with the scope **Read** for the API. |
| Your system leads                   | It creates, updates, and publishes episodes in Podigee, and it reads the state back. | A REST API token with the scope **Read and write**, or the account API key.                  |
| Both systems change the same fields | It reads and writes fields that your team also changes in Podigee.                   | The same as for the model in which your system leads.                                        |

### Podigee leads

Use this model when your team creates and publishes episodes in Podigee, and your website or app only shows them. It is the smallest integration, because your system sends no write requests.

* Read the Really Simple Syndication (RSS) feed when you need only the published episodes.
* Read `GET /episodes` when you also need episodes that are not published, for example scheduled episodes. The list contains all episodes unless you send `published=true`.
* Store the data that you read, and show the stored copy to your audience. Do not call the API for each visitor. See [Rate limits](https://docs.podigee.com/api-reference/rest-api/authentication-and-errors.md#rate-limits).
* Read only the changes since your last request. See [Read episodes in pages](https://docs.podigee.com/api-reference/rest-api/podcasts-and-episodes.md#read-episodes-in-pages).

### Your system leads

Use this model when your team approves and publishes in your own system, for example when an episode is a part of an article. [Publish an episode from your own system](https://docs.podigee.com/api-reference/rest-api/publish-an-episode-from-your-own-system.md) shows the complete sequence.

* Podigee stays the source of the encoded media, the feed, and the analytics. Your system reads them and does not write them.
* Tell your team which fields they must not change in Podigee. The next update from your system replaces a change to a field that it sends.
* Give the credential only the rights that the integration needs. See [Limit what an integration can do](https://docs.podigee.com/api-reference/rest-api/authentication-and-errors.md#limit-what-an-integration-can-do).

### Both systems change the same fields

Do not start with this model. Podigee sends no changes, so each system must read the other on a schedule. When a field changes in both systems between two reads, the later update replaces the earlier one, and no system reports the loss.

If you need changes in both directions, do these steps in sequence:

1. Build one direction first. Operate it until it is stable.
2. Divide the fields. Give each field one system that leads, as in the example below.
3. Add the second direction only for the fields that the other system leads.

No field then has two systems that change it.

## Example

A news publisher publishes each episode together with an article. The publisher decides this division before the integration is built:

| Data                                                   | System that leads                                                         | Direction                                                                                                   |
| ------------------------------------------------------ | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Title, description, show notes, and publication time   | The CMS                                                                   | The CMS sends them to Podigee.                                                                              |
| Audio file                                             | The CMS                                                                   | The CMS uploads the file. Podigee encodes it.                                                               |
| Episode `id`, production `id`, encoded media, and feed | Podigee                                                                   | The CMS reads them and stores the two `id` values.                                                          |
| Chapter marks and transcript                           | One system for each: the system in which the team writes or corrects them | Only from that system to the other system.                                                                  |
| Analytics                                              | Podigee                                                                   | The CMS reads them. See [REST API analytics](https://docs.podigee.com/api-reference/rest-api/analytics.md). |

## Important decisions

* Write the division of the fields down before you write code. Give it to each person who works in the two systems.
* Use one REST API token for each job, for example a token with the scope **Read** for the job that reads and a token with the scope **Read and write** for the job that publishes. You can then remove one token and keep the other.
* The request for an upload address has its own rule for REST API tokens. See [Before you start](https://docs.podigee.com/api-reference/rest-api/publish-an-episode-from-your-own-system.md#before-you-start).
* Select the key that connects the two systems. Store the Podigee episode `id` with your own identifier, and send your own `guid` or `number` when you create an episode. See [Protect episode creation](https://docs.podigee.com/api-reference/rest-api/retries-and-timeouts.md#protect-episode-creation).

## Related pages

* [Publish an episode from your own system](https://docs.podigee.com/api-reference/rest-api/publish-an-episode-from-your-own-system.md)
* [REST API retries and timeouts](https://docs.podigee.com/api-reference/rest-api/retries-and-timeouts.md)
* [REST API authentication and errors](https://docs.podigee.com/api-reference/rest-api/authentication-and-errors.md)
* [Get your API key or token](https://docs.podigee.com/documentation/connect-and-administer/integrations/get-your-api-key-or-token)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.podigee.com/api-reference/rest-api/decide-which-system-leads.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
