# IRPCObjectOperations.GetTemplates

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Objects, versions, properties and files](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetTemplates/

Badges: `Vault API / core` `write` `session or assertion` `returns metadata structure version`

Gets the templates of an object type, optionally only those of one class or matching keywords.

- **Service:** [Objects, versions, properties and files](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/index.md) `MFiles.IRPCObjectOperations`
- **gRPC method:** `/MFiles.IRPCObjectOperations/GetTemplates`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-templates`
- **Request:** [`GetTemplatesRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetTemplates/index.md#request)
- **Response:** [`GetTemplatesResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetTemplates/index.md#response)
- **Book and level:** Vault API, core
- **Kind:** write
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="request"></a>

## Request: GetTemplatesRequest

A structure that specifies the request type for the GetTemplates method.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `object_type_id` | `int32` | The object type of the templates. |
| `class_id` | optional `int32` | Optional class ID for fetching the templates of a specific class. |
| `search_keywords[]` | repeated `string` | The search keywords for the templates. |

<a id="response"></a>

## Response: GetTemplatesResponse

A structure that specifies the response type for the GetTemplates method.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `templates[]` | repeated [`Template`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Template/index.md) | Templates. |
| `templates[].title` | `string` | The title of the template file. |
| `templates[].title_resource` | `string` | The resource key for the title of the template file. It will be available only for blank template file. |
| `templates[].file_template_id` | `string` | The file ID of the template file. It will be available only for blank templates. |
| `templates[].obj_id` | [`ObjID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjID/index.md) | The template object ID. It will be available only for User defined templates. |
| `templates[].obj_id.type` | `int32` | The object type ID, for example 0 for documents. In a lookup value, the value list ID (for a lookup to objects, the object type ID). |
| `templates[].obj_id.item_id` | [`ItemID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ItemID/index.md) | The ID of the object within its type, in `item_id.internal_id`. |
| `templates[].class_id` | `int32` | The class of the object version. For blank templates it will be always 0, For user defined templates the class id of the object will be available. |
| `templates[].icon` | `bytes` | The icon for the template file. Currently it is not carrying any data. It will be implemented in future. |
| `templates[].restricted_to_classes[]` | repeated `uint32` | The array of restrict to class IDs. Currently it is not carrying any data. It will be implemented in future. |
