> Source: https://builder-docs.ema.ai/api-reference/ai-employees/template-api
> Title: Template API

# Template API

Templates are reusable configurations for creating AI Employees. This page documents the API endpoints for creating, updating, and managing access to templates.

## CreateTemplate

Create a new AI Employee template.

Property

Value

URL

`/api/personas/create_persona_template`

HTTP Method

POST

Protocol

REST (HTTP/JSON)

### Headers

Header

Type

Required

Description

`Authorization`

string

Yes

Bearer token

`Content-Type`

string

Yes

`application/json`

### Request Body

Field

Type

Required

Description

`name`

string

Yes

Display name of the template

`description`

string

No

Description of the template's purpose

`category`

string

No

Template category such as `GENERAL` or `EMPLOYEE_EXPERIENCE`

`proto_config`

object

No

Default protobuf configuration

`workflow_def`

object

No

Default workflow definition

`trigger_type`

string

No

Trigger type for personas created from this template

### Example

```bash
curl -X POST https://your-instance.ema.co/api/personas/create_persona_template \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "name": "Basic Q&A Template",
 "description": "Template for knowledge-base Q&A AI Employees",
 "category": "GENERAL",
 "proto_config": {
 "widgets": [],
 "display_settings": {
 "display_type": "SINGLE_PAGE"
 }
 }
 }'
```

### Response

Field

Type

Description

`template_id`

string

UUID of the created template

## UpdateTemplate

Update an existing template's configuration.

Property

Value

URL

`/api/personas/update_persona_template`

HTTP Method

POST

Protocol

REST (HTTP/JSON)

### Headers

Header

Type

Required

Description

`Authorization`

string

Yes

Bearer token

`Content-Type`

string

Yes

`application/json`

### Request Body

Field

Type

Required

Description

`template_id`

string

Yes

UUID of the template to update

`name`

string

No

Updated display name

`description`

string

No

Updated description

`category`

string

No

Updated category

`proto_config`

object

No

Updated protobuf configuration

`workflow_def`

object

No

Updated workflow definition

### Example

```bash
curl -X POST https://your-instance.ema.co/api/personas/update_persona_template \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "template_id": "<template-uuid>",
 "name": "Enhanced Q&A Template",
 "description": "Updated template with improved search and response"
 }'
```

## GrantAccess

Grant a tenant access to use a specific template.

Property

Value

URL

`/api/personas/grant_persona_template_access`

HTTP Method

POST

Protocol

REST (HTTP/JSON)

### Headers

Header

Type

Required

Description

`Authorization`

string

Yes

Bearer token

`Content-Type`

string

Yes

`application/json`

### Request Body

Field

Type

Required

Description

`template_id`

string

Yes

UUID of the template

`grantee_tenant_id`

string

Yes

UUID of the tenant to grant access to

### Example

```bash
curl -X POST https://your-instance.ema.co/api/personas/grant_persona_template_access \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "template_id": "<template-uuid>",
 "grantee_tenant_id": "<tenant-uuid>"
 }'
```

## RevokeAccess

Revoke a tenant's access to a specific template.

Property

Value

URL

`/api/personas/revoke_persona_template_access`

HTTP Method

POST

Protocol

REST (HTTP/JSON)

### Headers

Header

Type

Required

Description

`Authorization`

string

Yes

Bearer token

`Content-Type`

string

Yes

`application/json`

### Request Body

Field

Type

Required

Description

`template_id`

string

Yes

UUID of the template

`target_tenant_id`

string

Yes

UUID of the tenant to revoke access from

### Example

```bash
curl -X POST https://your-instance.ema.co/api/personas/revoke_persona_template_access \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "template_id": "<template-uuid>",
 "target_tenant_id": "<tenant-uuid>"
 }'
```

## GetPersonaTemplates

Retrieve available templates.

Property

Value

URL

`/api/personas/get_persona_templates`

HTTP Method

GET

Protocol

REST (HTTP/JSON)

### Headers

Header

Type

Required

Description

`Authorization`

string

Yes

Bearer token

### Example

```bash
curl -X GET https://your-instance.ema.co/api/personas/get_persona_templates \
 -H "Authorization: Bearer <access_token>"
```

### Response

Field

Type

Description

`templates`

array

List of PersonaTemplateDTO objects

Each template includes `id`, `name`, `description`, `category`, `icon`, and configuration details.

## GetPersonaTemplate

Retrieve a specific template by ID.

Property

Value

URL

`/api/personas/persona_template/{template_id}`

HTTP Method

GET

Protocol

REST (HTTP/JSON)

### Headers

Header

Type

Required

Description

`Authorization`

string

Yes

Bearer token

### Path Parameters

Parameter

Type

Description

`template_id`

string

UUID of the template

### Example

```bash
curl -X GET https://your-instance.ema.co/api/personas/persona_template/<template_id> \
 -H "Authorization: Bearer <access_token>"
```

## Related

-   [AI Employee Overview](/legacy-docs/api-reference/ai-employees/overview) -- Core concepts
-   [AI Employee API](/legacy-docs/api-reference/ai-employees/ai-employee-api) -- AI Employee CRUD operations
