> For the complete documentation index, see [llms.txt](https://docs.archera.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.archera.ai/help-center/archera-embedded/purchase-commitments.md).

# Purchase Commitments

Purchase cloud commitments to optimize costs for your customers using the Archera Partner API

Use the Archera Partner API to programmatically purchase cloud commitments for your customers.

**Prerequisites**:

* Partner API key and the customer organization ID from onboarding
* Customer organization must be onboarded with cloud integration complete
* Customer billing data must be synced (typically 24-48 hours after onboarding)

**Base URL:** `https://api.archera.ai/v2`

**Authentication:** Include `x-api-key: YOUR_PARTNER_API_KEY` header in all requests.

The examples use shell variables. Set them once, with your real values, before you run any command:

```shellscript
export PARTNER_API_KEY="your-partner-api-key"
export CHILD_ORG_ID="customer-organization-id"
```

***

### Step 1: Get the recommended commitment plan

Retrieve Archera's recommended commitment plan for the customer. `provider` is required and is `aws` or `azure`:

```shellscript
curl -H "x-api-key: $PARTNER_API_KEY" \
  "https://api.archera.ai/v2/org/$CHILD_ORG_ID/partners/purchase-plans-v2/recommended?provider=aws"
```

**Response:** the recommended plan for that provider, including its `id`, name, dates, projected savings, and line items. A `204 No Content` response means no recommendation exists yet, usually because billing data is still syncing.

**Save from response:** `id`. The next step uses it as `PLAN_ID`:

```shellscript
export PLAN_ID="id-from-the-response"
```

***

### Step 2: Purchase the commitment plan

Execute the purchase for the plan:

```shellscript
curl -X POST \
  -H "x-api-key: $PARTNER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"email": "admin@acmecorp.com"}' \
  https://api.archera.ai/v2/org/$CHILD_ORG_ID/partners/purchase-plans-v2/$PLAN_ID/purchase
```

**Parameters:**

* `email` - The user who executes the purchase. Archera records this user as the purchaser and gives them admin access to the customer organization if they do not have it yet.

The API executes the commitment purchase in the customer's cloud account and returns the purchased plan.

***

### What the API Enables

The Partner API provides:

* **Archera recommendations** for optimal commitment purchases based on usage patterns
* **Programmatic purchasing** without navigating cloud provider consoles
* **Automated optimization** that continuously finds savings opportunities
* **White-label capabilities** to embed in your platform

***

### Use Cases

By integrating commitment purchasing into your platform, you can:

* Deliver enterprise-grade cloud cost optimization as a native feature
* Create new revenue streams while keeping customers in your ecosystem
* Automate savings recommendations and execution on a schedule
* Build dashboards showing ROI and lifetime savings to customers


---

# 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.archera.ai/help-center/archera-embedded/purchase-commitments.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.
