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

# Deploys API

> Deploy a completed Capwrapper build to Google Play, the Apple App Store, or TestFlight using the REST API. Full parameter and response reference.

The Deploys API lets you submit a completed build directly to Google Play, the Apple App Store, or TestFlight without leaving your terminal or CI environment. You provide the build ID and your store credentials, and Capwrapper handles the submission on your behalf. Before deploying, make sure you have a successful build — see the [Builds API](/api/builds) for how to create and check builds.

***

## Deploy to an app store

**`POST /api/v1/deploys`**

Submit a completed build to Google Play, the App Store, or TestFlight.

<Note>
  The build referenced by `buildId` must have a `status` of `"success"` before you can deploy it. Attempting to deploy a build that is still queued, building, or failed will return a `400` error.
</Note>

### Request body

<ParamField body="buildId" type="string" required>
  The ID of a successful build to deploy. Returned by `POST /api/v1/builds` and visible in `GET /api/v1/builds/:id`.
</ParamField>

<ParamField body="platform" type="string" required>
  Target deployment platform. Accepted values:

  * `"android"` — submits to Google Play Store
  * `"ios"` — submits to the Apple App Store
  * `"testflight"` — submits to TestFlight for beta distribution
</ParamField>

<ParamField body="storeConfig" type="object" required>
  Platform-specific store credentials and metadata. The required fields differ by platform:

  * **Android**: provide `serviceAccountKey` (your Play Store service account JSON as a string) and `track` (e.g. `"production"`, `"beta"`, or `"internal"`).
  * **iOS / TestFlight**: provide `apiKey` (your App Store Connect API private key), `issuerId` (your issuer ID from App Store Connect), and `keyId` (your key ID from App Store Connect).
</ParamField>

### Example request (Android)

```bash theme={null}
curl -X POST https://api.capwrapper.com/v1/deploys \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "buildId": "bld_abc123xyz",
    "platform": "android",
    "storeConfig": {
      "serviceAccountKey": "{ ... your Play Store service account JSON ... }",
      "track": "production"
    }
  }'
```

### Response

```json theme={null}
{
  "id": "dep_xyz789",
  "status": "submitted",
  "buildId": "bld_abc123xyz",
  "platform": "android",
  "createdAt": "2026-04-11T10:05:00Z"
}
```

<ResponseField name="id" type="string">
  Unique deploy identifier.
</ResponseField>

<ResponseField name="status" type="string">
  Current deploy status. `"submitted"` means Capwrapper has handed the build off to the store API. Final review and processing times are determined by Google or Apple.
</ResponseField>

<ResponseField name="buildId" type="string">
  ID of the build that was deployed.
</ResponseField>

<ResponseField name="platform" type="string">
  The platform this deploy targets: `android`, `ios`, or `testflight`.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the deploy was created.
</ResponseField>

***

<Warning>
  Store credentials in `storeConfig` grant access to publish apps on your behalf. Never commit them to version control, paste them into chat tools, or log them to stdout. Use environment variables or a secrets manager to inject them at runtime.
</Warning>

<Tip>
  If you are deploying from a CI/CD pipeline, the [Capwrapper CLI](/cli/overview) is a simpler alternative to calling this endpoint directly. The CLI reads credentials from environment variables and handles the full deploy flow with a single command: `capwrap deploy`.
</Tip>
