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

# Agreement Ingestion

> Automatically ingest newly signed agreements from an e-signature platform into Royaltyport

After an agreement is signed in an e-signature platform (DocuSign, PandaDoc, Adobe Sign, or similar), it often sits there until someone manually downloads and uploads it into Royaltyport. This automation runs weekly, checks for newly completed agreements, fetches the signed documents, and uploads them to Royaltyport for automatic extraction.

## Trigger

**Schedule** — a CRON expression runs the workflow weekly (e.g. `0 8 * * 1` for every Monday at 8 AM).

## Workflow

<Steps>
  <Step title="Fetch recently signed agreements">
    An [API Request](/automations/steps/http-request) step calls the e-signature platform's API to list agreements completed in the past 7 days. Most platforms support filtering by status (`completed` / `signed`) and date range.
  </Step>

  <Step title="Filter already-ingested agreements">
    A [Database](/automations/steps/database) step reads the `ingested_agreements` table in an [automation database](/automations/databases) to get previously processed envelope or agreement IDs. A [Code](/automations/steps/code) step filters the list, removing any that have already been uploaded.
  </Step>

  <Step title="Loop over new agreements">
    A [Loop](/automations/steps/loop) step iterates over the remaining agreements. Inside each iteration:

    1. **Download the signed PDF** — an [API Request](/automations/steps/http-request) step fetches the completed document from the e-signature platform's download endpoint.
    2. **Upload to Royaltyport** — an [API Request](/automations/steps/http-request) step with the **Royaltyport API** preset uploads the file to the target project. Royaltyport's extraction pipeline processes the contract automatically.
  </Step>

  <Step title="Mark as ingested">
    A [Database](/automations/steps/database) step inserts the agreement ID, signing date, and Royaltyport contract ID into the `ingested_agreements` table so it is skipped on future runs.
  </Step>
</Steps>

<Tip>
  Once the file is uploaded via the Royaltyport API, the platform's extraction pipeline kicks in automatically — extracting parties, royalty rates, territories, dates, and all other structured data. No manual processing needed.
</Tip>

## Key Features Used

* [Schedule trigger](/automations/triggers#schedule) for weekly polling
* [Automation database](/automations/databases) for deduplication tracking
* [Code step](/automations/steps/code) for filtering already-ingested agreements
* [Royaltyport API](/automations/steps/http-request#royaltyport-api) for automated contract upload
* [Loop](/automations/steps/loop) to process multiple agreements in a single run

## Related Documentation

<CardGroup cols={2}>
  <Card title="API Request" icon="globe" href="/automations/steps/http-request">
    Configure API calls to e-signature platforms and Royaltyport.
  </Card>

  <Card title="Databases" icon="database" href="/automations/databases">
    Track ingested agreements to prevent duplicates.
  </Card>

  <Card title="Contract Upload API" icon="upload" href="/api-reference/rest-api/contracts">
    Upload contracts programmatically via the REST API.
  </Card>

  <Card title="More Examples" icon="lightbulb" href="/automations/examples/overview">
    Browse all example workflows.
  </Card>
</CardGroup>
