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

# Quickstart

> Get started with the Appfox API in 5 minutes

This guide walks you through authenticating and making your first API request.

## Prerequisites

* An active Appfox Subscriptions installation
* The **Enterprise** plan (external API access is Enterprise-only)
* At least one active subscription contract in your shop

## Step 1: Generate an API key

1. Open the Appfox Subscriptions app in your Shopify admin
2. Click **API** in the sidebar
3. Click **Generate key**
4. Copy the key that starts with `afx_live_` — you'll only see it once

Store the key securely in your server-side environment (e.g., as an environment variable or in a secrets manager).

## Step 2: Get a contract ID

You'll need a subscription contract ID to test with. You can find contract IDs in:

* The Appfox app under **Subscriptions** (the numeric ID in the URL or table)
* Your Shopify admin under **Orders → Subscriptions**
* Shopify's Admin GraphQL API

For this example, we'll use contract ID `123456789`.

## Step 3: Pause a subscription

Try pausing a subscription with a 30-day resumption:

```bash theme={null}
curl https://subscriptions-app-new.getappfox.com/api/v1/subscription-contracts/123456789/actions \
  -X POST \
  -H "Authorization: Bearer afx_live_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "pause",
    "resumeAt": "2026-10-01T09:00:00Z"
  }'
```

Replace:

* `afx_live_YOUR_KEY_HERE` with your actual API key
* `123456789` with a real contract ID
* `2026-10-01T09:00:00Z` with a future date (up to 60 days from now)

### Expected response

```json theme={null}
{
  "data": {
    "id": "gid://shopify/SubscriptionContract/123456789",
    "status": "PAUSED",
    "scheduledResumeAt": "2026-10-01T09:00:00.000Z"
  }
}
```

The subscription is now paused and will automatically resume at the scheduled time.

## Step 4: Resume immediately

To resume the subscription before the scheduled time:

```bash theme={null}
curl https://subscriptions-app-new.getappfox.com/api/v1/subscription-contracts/123456789/actions \
  -X POST \
  -H "Authorization: Bearer afx_live_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"action": "resume"}'
```

### Expected response

```json theme={null}
{
  "data": {
    "id": "gid://shopify/SubscriptionContract/123456789",
    "status": "ACTIVE",
    "scheduledResumeAt": null
  }
}
```

## Common issues

**401 Unauthorized:** Check that your API key is correct and hasn't been revoked.

**403 Forbidden:** Verify that your shop is on the Enterprise plan.

**404 Not Found:** Make sure the contract ID exists and belongs to the shop that generated the API key.

**422 Invalid Resume Time:** Ensure `resumeAt` is:

* A valid ISO-8601 timestamp
* In the future
* No more than 60 days from now

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/api/authentication">
    Learn about key management and security best practices
  </Card>

  <Card title="Contract actions" icon="arrows-rotate" href="/api/contracts">
    View full documentation for all contract actions
  </Card>
</CardGroup>
