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

# Template Registration

> Learn how to register an After Effects template in Nexrender Cloud via API.

Before Nexrender Cloud can process your project files, you need to **register a template object** using the API.\
This step defines what kind of project you’re uploading and prepares secure storage for it in Nexrender Cloud.

You can register and upload one of the following file types:

* **`.aep`** — Standard After Effects project
* **`.zip`** — Bundled project with all assets included
* **`.mogrt`** — Motion Graphics Template

#### Example: Register a Template

<CodeGroup>
  ```bash Register a Template theme={null}
  curl -X POST https://api.nexrender.com/api/v2/templates \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "type": "aep",
      "displayName": "My First Video"
    }'
  ```

  ```bash Template Registration Response theme={null}
  "template": {
          "id": "01K8NKEDR9HCGNK3BB7QM6XR8P",
          "type": "zip",
          "displayName": "test",
          "status": "awaiting_upload",
          "createdAt": "2025-10-28T14:27:10.217Z",
          "updatedAt": "2025-10-28T14:27:10.217Z",
          "mogrt": {}
      },
      "uploadInfo": {
          "url": "https://nx1-assets-eu.hel1.your-objectstorage.com/01JQEGHQFANYJT2Z52G7XV8JQQ/templates/01K8NKEDRBB7479ERKMERGXB7Z.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=LJ0F6FQU9N6ASUST5SQK%2F20251028%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20251028T142710Z&X-Amz-Expires=3600&X-Amz-Signature=38f4b903ee7f96d68368f8df4c1e7394a3a797716c9b8e838ef86625e39cb82d&X-Amz-SignedHeaders=host&x-amz-checksum-crc32=AAAAAA%3D%3D&x-amz-meta-templateid=01K8NKEDR9HCGNK3BB7QM6XR8P&x-amz-sdk-checksum-algorithm=CRC32&x-id=PutObject",
          "method": "PUT",
          "fields": {
              "Content-Type": "application/octet-stream",
              "x-amz-meta-custom": "{\"templateId\":\"01K8NKEDR9HCGNK3BB7QM6XR8P\"}"
          },
          "expiresIn": 3600,
          "key": "01JQEGHQFANYJT2Z52G7XV8JQQ/templates/01K8NKEDRBB7479ERKMERGXB7Z.zip"
      }
  }
  ```
</CodeGroup>

## Uploading Your Files

### Upload via Temporary Link

After registering a template, Nexrender Cloud generates a **temporary upload link** (`uploadInfo.url`).\
This presigned URL allows you to securely upload your project file without additional authentication.

The `uploadInfo.url` is a **time-limited presigned URL** — it grants secure, temporary access to upload the file directly. The method is always `PUT`.

### Example `curl` Request

You can replace `.zip` with `.aep` or `.mogrt` depending on your project.

<CodeGroup>
  ```bash Template File Upload Request theme={null}
  curl --location --request PUT \
    'https://your-upload-url-from-uploadInfo.url' \
    --header 'Content-Type: application/octet-stream' \
    --data-binary '@/path/to/your/project.zip'
  ```
</CodeGroup>

### Limitations

To ensure stable upload performance, a few technical limitations apply:

* Maximum file size: 2 GiB
* Upload duration: URLs typically expire after \~1 hour
* Upload method: Always PUT
* File format: Must match the declared type (.aep, .zip, or .mogrt)

Files exceeding the 2 GiB limit or uploaded after expiration will fail with an HTTP 403 or similar error.

### Refreshing an Expired Upload URL

If the presigned URL from template registration has expired before you completed the upload, request a fresh one using `PUT /templates/{id}/upload`. This generates a new presigned URL for the same template without creating a new template object.

<CodeGroup>
  ```bash Request theme={null}
  curl -X PUT https://api.nexrender.com/api/v2/templates/01JTGM9GCR71JV7EJYDF45QAFD/upload \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```json Response theme={null}
  {
    "url": "https://nx1-assets-eu.cloudflarestorage.com/...?X-Amz-Expires=3600&...",
    "method": "PUT",
    "fields": {
      "Content-Type": "application/octet-stream"
    },
    "expiresIn": 3600,
    "key": "01JQEGHQFANYJT2Z52G7XV8JQQ/templates/01JTGM9GCR71JV7EJYDF45QAFD.zip"
  }
  ```
</CodeGroup>

Use the returned `url` exactly as you would the original `uploadInfo.url` - a standard `PUT` request with your file as the body.

## Download Template Files During Template Registration

Instead of uploading template files manually, you can also provide a direct file URL during registration using the optional **'src'** field. Nexrender will download the file automatically, process it, and transition the template through the same lifecycle.

<CodeGroup>
  ```bash Register Template with field theme={null}
   curl -X POST https://api.nexrender.com/api/v2/templates \
   -H "Authorization: Bearer YOUR_API_KEY" \
   -H "Content-Type: application/json" \
   -d '{
     "type": "zip",
     "displayName": "Logo Animation",
     "src": "https://example.com/files/logo-animation.zip"
   }'
  ```

  ```bash Register Template with field - Response theme={null}
  {
    "id": "tpl_01JZ2M9GCR712V7EJYDF45QAFD",
    "type": "zip",
    "displayName": "Logo Animation",
    "status": "downloading",
    "createdAt": "2025-10-28T09:57:43.121Z",
    "updatedAt": "2025-10-28T09:57:43.121Z",
    "mogrt": {},
    "error": null,
    "src": "https://example.com/files/logo-animation.zip"
  }
  ```
</CodeGroup>

## What Happens Behind the Scenes?

* The backend **initiates a download** of your file from the provided `src` URL
* The system **validates and processes** the project automatically after download
* Extracts **available compositions and layers** for later use in render jobs
* The template status is initially set to **`downloading`**, then transitions to **`processing`** and finally **`uploaded`**.

If the platform cannot download the file, it will **retry up to three times** before setting the template status to `error`.

## Requirements

* The `src` must be a **directly downloadable HTTPS link**
* Supported sources include:
  * Secure `https://` URLs
  * Google Drive shared links
  * Presigned S3 URLs
* The maximum supported file size is **2 GiB**
* Maximum download time is **10 minutes**

## Common Mistakes to Avoid

| Mistake                               | Result                                          |
| ------------------------------------- | ----------------------------------------------- |
| Providing a non-secure `http://` link | The request will be rejected                    |
| Using an expired or inaccessible URL  | Template enters the `error` state after retries |
| File larger than 2 GiB                | Download will fail before processing            |

Once the download and processing are complete, the status will transition to `uploaded`, and Nexrender Cloud will extract all available compositions and dynamic layers for use in jobs.

### Checking Upload Status

Once the upload is complete, the template status transitions automatically:

`awaiting_upload` → `processing` → `uploaded`

Once `uploaded`, Nexrender has completed introspection and the template is ready to render jobs. Use the v3 endpoints to inspect discovered compositions and layers - see [Inspecting Templates](/docs/cloud/templates/inspecting).

## API Reference


## OpenAPI

````yaml POST /templates
openapi: 3.0.4
info:
  title: Nexrender API
  version: '2.0'
  description: >
    REST API for the Nexrender cloud rendering platform, enabling programmatic
    control over After Effects template processing, job management, and asset
    handling.


    Features include:


    - Template upload and management (AEP, MOGRT, ZIP files)

    - Job creation and status monitoring with real-time progress

    - Job nesting for multi-composition renders (parent/child jobs)

    - Job stitching to combine multiple videos into one

    - Batch job creation for submitting up to 1000 jobs at once

    - Font library management for typography consistency

    - Secret management for secure API key storage

    - Webhook notifications for job lifecycle events

    - Asset injection for dynamic content replacement


    Authentication is required for all endpoints using Bearer token
    authorization.
servers:
  - url: https://api.nexrender.com/api/v2
    description: Production API server
security:
  - apiToken: []
paths:
  /templates:
    post:
      tags:
        - Template Management
      summary: Create new template
      description: Create a new template with specified type and display name
      operationId: createOrUpdateTemplate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateCreation'
      responses:
        '201':
          description: Template successfully created with upload information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '400':
          description: Invalid request - missing required fields or invalid template type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized - invalid or missing API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    TemplateCreation:
      type: object
      description: >-
        Configuration for creating a new template with project file type and
        display information
      properties:
        type:
          type: string
          enum:
            - aep
            - zip
            - mogrt
          description: >-
            Template project file type - aep (After Effects Project), zip
            (compressed project), or mogrt (Motion Graphics Template)
        displayName:
          type: string
          description: Human-readable name for the template shown in UI and listings
        src:
          type: string
          description: >-
            Link to the project file nexrender should create the template from.
            If not set, presigned upload URL is returned in the response object
            instead.
      required:
        - type
        - displayName
    Template:
      type: object
      description: >-
        Complete template object with metadata, processing status, and content
        information
      properties:
        id:
          type: string
          description: >-
            Unique template identifier used for referencing in jobs and API
            operations
        type:
          type: string
          description: Template file format (aep, zip, or mogrt)
        displayName:
          type: string
          description: Human-readable name displayed in UI and template listings
        status:
          type: string
          description: >-
            Current processing status (awaiting_upload, processing, uploaded,
            error)
        createdAt:
          type: string
          format: date-time
          description: ISO timestamp when the template was initially created
        updatedAt:
          type: string
          format: date-time
          description: ISO timestamp of the most recent template modification
        compositions:
          type: array
          items:
            type: string
            description: Individual composition name available for rendering
          description: List of compositions found within the template that can be rendered
        layers:
          type: array
          items:
            type: string
            description: Individual layer name within the template
          description: List of layers available for asset replacement and manipulation
        mogrt:
          type: object
          description: Motion Graphics Template specific metadata and properties
          additionalProperties: true
        error:
          type: string
          nullable: true
          description: >-
            Error message if template processing or validation failed (null if
            successful)
        uploadInfo:
          $ref: '#/components/schemas/TemplateUploadInfo'
    ValidationErrorResponse:
      type: object
      description: Validation error response with detailed field information
      properties:
        error:
          type: string
          description: Main error message
        details:
          type: array
          description: Array of specific validation errors for individual fields
          items:
            type: object
            properties:
              field:
                type: string
                description: Field name that failed validation
              message:
                type: string
                description: Specific validation error for this field
    ErrorResponse:
      type: object
      description: Standard error response format
      properties:
        error:
          type: string
          description: Human-readable error message explaining what went wrong
      required:
        - error
    TemplateUploadInfo:
      type: object
      description: >-
        Presigned upload URL and metadata for securely uploading template files
        to cloud storage
      properties:
        url:
          type: string
          description: Presigned upload URL with temporary access credentials
        method:
          type: string
          enum:
            - PUT
            - POST
          description: HTTP method required for the upload operation
        fields:
          type: object
          description: Additional form fields or headers required for successful upload
          additionalProperties:
            type: string
        expiresIn:
          type: integer
          description: Time in seconds until the upload URL expires and becomes invalid
        key:
          type: string
          description: Unique storage key/path where the uploaded file will be stored
      required:
        - url
        - method
        - expiresIn
        - key
  securitySchemes:
    apiToken:
      type: http
      scheme: bearer
      description: >
        Bearer token authentication using API tokens for team-based access
        control.


        You can generate your own API token at:
        https://app.nexrender.com/settings/api-tokens

````