---
title: "Create a managed Agent Enrollment"
description: "Issue an idempotent one-time Enrollment before or after customer onboarding."
---
<nav class="docs-breadcrumb" aria-label="Breadcrumb"><a href="/docs/">CloudPrint Documentation</a><span aria-hidden="true">/</span><span>API reference</span></nav>

# Create a managed Agent Enrollment

<p class="docs-lead">Issue an idempotent one-time Enrollment before or after customer onboarding.</p>

<div class="api-endpoint-summary"><span class="api-method api-method-post">POST</span><code>/partner-api/v1/accounts/{relationshipId}/agent-enrollments</code><span><strong>API version:</strong> v1</span><span><strong>operationId:</strong> <code>createPartnerAgentEnrollment</code></span><a href="/docs/api/v1/partner/agent-enrollments/create/index.md">View as Markdown</a></div>

## What this endpoint does

Issue an idempotent one-time Enrollment before or after customer onboarding.

## Authentication

Send a one-time RS256 Developer Application assertion in `Authorization: Bearer <application_assertion>`. This assertion is not a Public API access token.

## Request

**Production base URL:** `https://public-api.cloudprint.me/partner-api/v1/accounts/{relationshipId}/agent-enrollments`

### Parameters

| Name | Location | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- | --- |
| `relationshipId` | path | `string (uuid)` | yes | — | — |
| `Idempotency-Key` | header | `string` | yes | — | minLength: 1; maxLength: 200 |

### Request body

**Content type:** `application/json`

| Name | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `name` | `string` | no | Optional operator-facing computer name. When omitted, CloudPrint derives a name from the managed Account. A supplied name is trimmed, must contain 1 to 255 Unicode characters and must not contain ASCII control characters. | minLength: 1; maxLength: 255; example: `"Warehouse workstation 2"` |
| `agent_onboarding` | `object` | yes | — | — |
| `replaces_enrollment_id` | `string \| null (uuid)` | no | Optional unclaimed Enrollment to revoke atomically before issuing the new one. | — |

### Example requests

#### cURL

```bash
curl -sS -X POST "https://public-api.cloudprint.me/partner-api/v1/accounts/$RELATIONSHIP_ID/agent-enrollments" \
  -H "Authorization: Bearer $APPLICATION_ASSERTION" \
  -H 'Idempotency-Key: customer-42-agent-2-v1' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Warehouse workstation 2",
    "agent_onboarding": {
      "return_uri": "https://app.integrator.example/cloudprint/callback",
      "state": "new-single-use-random-state"
    }
  }'
```

## Response

**HTTP status:** `201` — Agent Enrollment created

### Response fields

| Name | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `agent_enrollment_id` | `string (uuid)` | yes | Stable identifier of this resource. | — |
| `expires_at` | `string (date-time)` | yes | ISO 8601 timestamp recorded by CloudPrint. | — |
| `agent_onboarding_url` | `string (uri)` | yes | CloudPrint-selected hosted onboarding URL. Open the complete value unchanged, including its #token fragment. Do not parse, log, proxy or rebuild it. | example: `"https://connect.cloudprint.me/setup#token=cpat_example"` |
| `status` | `string` | yes | Current resource or workflow state; use the endpoint-specific enum values. | enum: `pending` |

### Example response

```json
{
  "agent_enrollment_id": "11111111-1111-4111-8111-111111111111",
  "expires_at": "2026-08-06T12:00:00Z",
  "agent_onboarding_url": "https://connect.cloudprint.me/setup#token=cpat_example",
  "status": "pending"
}
```

## Errors

| HTTP status | Description |
| --- | --- |
| `401` | Application assertion is invalid |
| `403` | Partner capability is not granted |
| `404` | Managed Account or replacement Enrollment was not found |
| `409` | Idempotency key conflicts with a previous request |
| `422` | Request is invalid |
| `429` | Rate limit exceeded |
| `500` | Unexpected error |

## Integration guidance

## Related documentation

<div class="docs-card-grid"><a class="docs-card" href="/docs/api/v1/partner/agent-enrollments/list/"><strong>List managed Agent Enrollments</strong><span>List pending, claimed, expired and revoked Agent Enrollments without exposing their secret codes.</span></a>
<a class="docs-card" href="/docs/api/v1/partner/agent-enrollments/get/"><strong>Get one Agent Enrollment</strong><span>Check the exact one-time Agent Enrollment created for a managed customer and correlate it with the connected Agent.</span></a>
<a class="docs-card" href="/docs/api/v1/idempotency/"><strong>Idempotent print-job creation</strong><span>Prevent duplicate physical prints when retrying CloudPrint print-job requests after a timeout or network failure.</span></a></div>

<nav class="docs-resource-links" aria-label="Next steps"><a href="/docs/api/v1/explorer/">OpenAPI</a><a href="https://my.cloudprint.me">Open account</a><a href="/docs/legal/privacy/">Privacy Policy</a><a href="/docs/legal/terms/">Terms</a><a href="/docs/legal/payments-and-refunds/">Payment and refunds</a><a href="/docs/legal/data-processing/">DPA</a></nav>