# Blueprints

Templates · PassBook API reference. Authenticate with `Authorization: Bearer $PASSBOOK_KEY`.

## Make a template in an organization from a blueprint {#use}

`POST /api/v1/templates/{id}/use`

Scopes: `templates:write`. SDK name: `pb.blueprints.use`.

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string · max 64 | yes |  |
| `orgId` | body | string · max 64 | yes |  |
| `name` | body | string · max 120 | yes |  |
| `version` | body | object |  |  |
| · `passJson` | body | object | yes |  |
| · `manifest` | body | object | yes |  |
| · `assets` | body | object \| object[] |  |  |
| `baseVersion` | body | string · max 64 |  |  |

Returns `201`, a `TemplateDetail`.

| Code | Status | Fix |
| --- | --- | --- |
| `ARCHIVE_TOO_LARGE` |  | Remove unused files and upload an archive under 15 MB. |
| `ASSETS_INVALID` |  | Fix the files named in issues and upload the archive again. |
| `ASSET_NOT_FOUND` |  | Check the image name or id and that it belongs to this organization. |
| `FORBIDDEN` |  | Use a key with the scope the operation lists, or ask an org admin. |
| `IMPORT_CONFLICT` |  | Send the request again. |
| `INVALID_API_KEY` |  | Create a new key in the console and update PASSBOOK_KEY. |
| `INVALID_CURSOR` |  | Pass the nextCursor from the previous page unchanged, or drop it to start over. |
| `INVALID_INPUT` |  | Fix the inputs named in issues; GET /api/v1/templates/{id}/input-schema lists them. |
| `KEY_CREATOR_GONE` |  | Create a new key with POST /api/v1/api-keys. |
| `KEY_CREATOR_NOT_MEMBER` |  | Create a new key from a current member with POST /api/v1/api-keys. |
| `KEY_TEST_ONLY` |  | Use a pb_test_ key. |
| `MANIFEST_INVALID` |  | Fix the manifest fields listed in issues and upload it again. |
| `MISSING_SCOPE` |  | Create a key with the scope the operation lists under security. |
| `NOT_A_ZIP` |  | Upload the template as a .zip file. |
| `NOT_FOUND` |  | Check the id, and that the key's mode (test or live) matches the object. |
| `NO_FILE` |  | Send the archive as multipart form data in the file field. |
| `ORG_NOT_FOUND` |  | Check orgId with GET /api/v1/orgs. |
| `ORG_REQUIRED` |  | Send orgId with the request, or use a key scoped to one organization. |
| `RATE_LIMITED` |  | Wait for Retry-After seconds, then retry. Back off on repeats. |
| `STAMPS_ABOVE_MAX` |  | Raise the template's stamp maximum, or redeem stamps first. |
| `STAMPS_NONE` |  | Use a template with stamps. |
| `STAMPS_QUERY` |  | Retry the request. |
| `STAMPS_REDRAW` |  | Make the change in the template designer and publish a new version. |
| `TEMPLATE_ARCHIVED` |  | Restore it with POST /api/v1/templates/{id}/restore, or use another template. |
| `TEMPLATE_ASSET_CONFLICT` |  | Upload the template version again. |
| `TEMPLATE_BAKED` |  | Clone it with POST /api/v1/templates/{id}/clone and change the clone. |
| `TEMPLATE_BLUEPRINT_INACTIVE` |  | Pick another. |
| `TEMPLATE_CANDIDATE_NOT_FOUND` |  | Check the id with GET /api/v1/templates/{id}/candidates. |
| `TEMPLATE_CONFLICT` |  | Fetch it with GET /api/v1/templates/{id} and send your change again. |
| `TEMPLATE_CONTENT_CHANGED` |  | Send the request again to use the current release. |
| `TEMPLATE_EXISTS` |  | Pick another name. |
| `TEMPLATE_IN_USE` |  | Remove it from them first. |
| `TEMPLATE_IS_BLUEPRINT` |  | Use this blueprint to make one first. |
| `TEMPLATE_MODE_MISMATCH` |  | Use a key of the template's mode. |
| `TEMPLATE_NOT_BLUEPRINT` |  | Duplicate a template instead. |
| `TEMPLATE_NOT_FOUND` |  | Check the id with GET /api/v1/templates and the key's mode. |
| `TEMPLATE_NOT_SHAREABLE` |  | Share an upload that no organization has taken. |
| `TEMPLATE_NOT_TESTED` |  | Release it in Test first. |
| `TEMPLATE_ORG_REQUIRED` |  | Assign the template to an organization, then retry. |
| `TEMPLATE_PROVIDER_UNSUPPORTED` |  | Configure the provider for the organization, or release for another provider. |
| `TEMPLATE_RELEASE_CONFLICT` |  | Send the request again to use the current release. |
| `TEMPLATE_RELEASE_NOT_FOUND` |  | Check the id with GET /api/v1/templates/{id}/releases. |
| `TEMPLATE_RELEASE_REQUIRED` |  | Approve a release with POST /api/v1/templates/{id}/candidates/{candidateId}/approve. |
| `TEMPLATE_SLUG_CONFLICT` |  | Send the request again, or choose a different name. |
| `TEMPLATE_USED_BY_OTHER_ORG` |  | Reissue or delete them first. |
| `TEMPLATE_VERSION_CONFLICT` |  | Fetch the template and publish again. |
| `TEMPLATE_VERSION_CONTENT_CONFLICT` |  | Run the sync again. |
| `TEMPLATE_VERSION_NOT_FOUND` |  | Check the version with GET /api/v1/templates/{id}. |
| `UNAUTHENTICATED` |  | Send Authorization: Bearer $PASSBOOK_KEY. |
| `UPLOAD_NOT_FOUND` |  | Check the id with GET /api/v1/templates/uploads. |
| `VALIDATION` |  | Fix each field in issues and resend. |
| `VERSION_INVALID` |  | Use a version number from GET /api/v1/templates/{id}. |
| `WORKFLOW_START` |  | Send the request again. |

```sh
curl -X POST "https://passbook.mobile/api/v1/templates/baked:starter-event-ticket/use" \
  -H "Authorization: Bearer $PASSBOOK_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "orgId": "0193a1b2-7c00-7000-8000-0000000000a1",
  "name": "Example"
}'
```

## Console only

Signed-in console sessions only; an API key cannot call these.

- `POST /api/v1/templates/{id}/use/check`: Check a designer draft made from a blueprint as the organization's template
