# Templates

## Create backup Template

> Creates a backup Template. You can configure record selection using declarative, SOQL, or SQL filters

```json
{"openapi":"3.0.0","info":{"title":"Flosum Backup API Service","version":"4.6.12-test.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer <access_token>"}},"schemas":{"CreateTemplateBodyDto":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["backup","archive"]},"description":{"type":"string"},"templateSteps":{"type":"array","items":{"$ref":"#/components/schemas/TemplateStep"}}},"required":["name","type","templateSteps"]},"TemplateStep":{"type":"object","properties":{"relationshipName":{"type":"string"},"objectApiName":{"type":"string"},"label":{"type":"string"},"filterMode":{"type":"string","enum":["soql","declarative"]},"fieldsDescribe":{"type":"array","items":{"$ref":"#/components/schemas/FieldDescribe"}},"soqlFilter":{"type":"string"},"customLogic":{"type":"string"},"declarativeFilter":{"type":"array","items":{"$ref":"#/components/schemas/DeclarativeFilterLine"}},"skipRemove":{"type":"boolean"},"children":{"type":"array","items":{"$ref":"#/components/schemas/TemplateStep"}}},"required":["objectApiName","label","filterMode","fieldsDescribe","children"]},"FieldDescribe":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"isRequired":{"type":"boolean"},"isFilterable":{"type":"boolean"},"createable":{"type":"boolean"},"defaultedOnCreate":{"type":"boolean"},"nillable":{"type":"boolean"}},"required":["name","label","type","isRequired","isFilterable"]},"DeclarativeFilterLine":{"type":"object","properties":{"field":{"type":"string"},"label":{"type":"string"},"option":{"type":"string","enum":["equals","not equals","less than","greater than","less or equals","greater or equals","contains","does not contain","starts with","includes","excludes","in","not in"]},"value":{"type":"string"}},"required":["field","label","option","value"]},"CreateTemplateResponseDto":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"ValidationExceptionDto":{"type":"object","properties":{"error":{"type":"string","nullable":true},"message":{"type":"array","items":{"type":"string"}},"statusCode":{"type":"number","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]}},"required":["error","message","statusCode"]},"NotFoundExceptionDto":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string","nullable":true},"statusCode":{"type":"number","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]}},"required":["message","error","statusCode"]}}},"paths":{"/api/v1/connections/{connectionId}/templates/backup":{"post":{"operationId":"TemplatesController_createBackupTemplate","summary":"Create backup Template","description":"Creates a backup Template. You can configure record selection using declarative, SOQL, or SQL filters","parameters":[{"name":"connectionId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateBodyDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateResponseDto"}}}},"400":{"description":"Incorrect request data is provided. For example, connectionId isn't a valid positive number","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationExceptionDto"}}}},"404":{"description":"Connection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundExceptionDto"}}}}},"tags":["Templates"]}}}}
```

## Get list of Templates

> Returns a paginated list of Templates with customizable page size

```json
{"openapi":"3.0.0","info":{"title":"Flosum Backup API Service","version":"4.6.12-test.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer <access_token>"}},"schemas":{"FindAllTemplatesResponseDto":{"type":"object","properties":{"total":{"type":"number","description":"Total number of entities."},"items":{"type":"array","items":{"$ref":"#/components/schemas/FindAllTemplatesRowDto"}},"backupTemplatesCount":{"type":"number"},"archiveTemplatesCount":{"type":"number"}},"required":["total","items","backupTemplatesCount","archiveTemplatesCount"]},"FindAllTemplatesRowDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"type":{"type":"string","enum":["backup","archive"]},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","name","type","updatedAt"]},"ValidationExceptionDto":{"type":"object","properties":{"error":{"type":"string","nullable":true},"message":{"type":"array","items":{"type":"string"}},"statusCode":{"type":"number","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]}},"required":["error","message","statusCode"]},"NotFoundExceptionDto":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string","nullable":true},"statusCode":{"type":"number","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]}},"required":["message","error","statusCode"]}}},"paths":{"/api/v1/connections/{connectionId}/templates":{"get":{"operationId":"TemplatesController_findAll","summary":"Get list of Templates","description":"Returns a paginated list of Templates with customizable page size","parameters":[{"name":"connectionId","required":true,"in":"path","schema":{"type":"number"}},{"name":"search","required":false,"in":"query","description":"Search term (max 80)","schema":{"type":"string"}},{"name":"page","required":true,"in":"query","description":"Number of page (min 1)","schema":{"type":"number"}},{"name":"limit","required":true,"in":"query","description":"Limit of entities per page (min 1, max 2000)","schema":{"type":"number"}},{"name":"types","required":true,"in":"query","schema":{"type":"array","items":{"type":"string","enum":["backup","archive"]}}},{"name":"sortBy","required":false,"in":"query","schema":{"enum":["name","updatedAt"],"type":"string"}},{"name":"order","required":false,"in":"query","schema":{"enum":["ASC","DESC"],"type":"string"}}],"responses":{"200":{"description":"Returns a paginated list of Templates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FindAllTemplatesResponseDto"}}}},"400":{"description":"Incorrect request data is provided. For example, page or limit parameters are missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationExceptionDto"}}}},"404":{"description":"Connection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundExceptionDto"}}}}},"tags":["Templates"]}}}}
```

## Get backup Template by Id

> Returns the Template by Id

```json
{"openapi":"3.0.0","info":{"title":"Flosum Backup API Service","version":"4.6.12-test.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer <access_token>"}},"schemas":{"FindOneTemplateResponseDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"type":{"type":"string","enum":["backup","archive"]},"description":{"type":"string"},"roots":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/RootDto"}}}},"required":["id","name","type","roots"]},"RootDto":{"type":"object","properties":{"relationshipName":{"type":"string"},"objectApiName":{"type":"string"},"label":{"type":"string"},"soqlFilter":{"type":"string"},"customLogic":{"type":"string"},"declarativeFilter":{"type":"array","items":{"$ref":"#/components/schemas/DeclarativeFilterLine"}},"skipRemove":{"type":"boolean"},"id":{"type":"number"},"level":{"type":"number"},"filterMode":{"type":"string","enum":["soql","declarative"]},"parentId":{"type":"number"}},"required":["objectApiName","label","id","level"]},"DeclarativeFilterLine":{"type":"object","properties":{"field":{"type":"string"},"label":{"type":"string"},"option":{"type":"string","enum":["equals","not equals","less than","greater than","less or equals","greater or equals","contains","does not contain","starts with","includes","excludes","in","not in"]},"value":{"type":"string"}},"required":["field","label","option","value"]},"ValidationExceptionDto":{"type":"object","properties":{"error":{"type":"string","nullable":true},"message":{"type":"array","items":{"type":"string"}},"statusCode":{"type":"number","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]}},"required":["error","message","statusCode"]},"NotFoundExceptionDto":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string","nullable":true},"statusCode":{"type":"number","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]}},"required":["message","error","statusCode"]}}},"paths":{"/api/v1/connections/{connectionId}/templates/backup/{id}":{"get":{"operationId":"TemplatesController_findOneBackupTemplate","summary":"Get backup Template by Id","description":"Returns the Template by Id","parameters":[{"name":"connectionId","required":true,"in":"path","schema":{"type":"number"}},{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Returns the Template by Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FindOneTemplateResponseDto"}}}},"400":{"description":"Incorrect request data is provided. For example, templateId isn't a valid number","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationExceptionDto"}}}},"404":{"description":"Template not found with the provided Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundExceptionDto"}}}}},"tags":["Templates"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flosum.com/api/api-es/api-de-copia-de-seguridad-y-archivo/templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
