> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.monite.com/v2024-01-31/api/mail-templates/get-mail-templates/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.monite.com/_mcp/server. # Get All With Filters GET https://api.sandbox.monite.com/v1/mail_templates Get all custom templates Reference: https://docs.monite.com/api/mail-templates/get-mail-templates ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://api.sandbox.monite.com/v1` (sandbox, default) - `https://api.monite.com/v1` (eu_production) - `https://us.api.monite.com/v1` (na_production) ## Request ### Query parameters - `order` (enum, optional) — Sort order (ascending by default). Typically used together with the `sort` parameter. - Allowed values: `asc`, `desc` - `limit` (integer, optional, default: 100) — The number of items (0 .. 100) to return in a single page of the response. The response may contain fewer items if it is the last or only page. - `pagination_token` (string, optional) — A pagination token obtained from a previous call to this endpoint. Use it to get the next or previous page of results for your initial query. If `pagination_token` is specified, all other query parameters are ignored and inferred from the initial query. If not specified, the first page of results will be returned. - `sort` (enum, optional) — The field to sort the results by. Typically used together with the `order` parameter. - Allowed values: `type`, `name` - `type` (enum, optional) - Allowed values: `receivables_quote`, `receivables_invoice`, `receivables_paid_invoice`, `receivables_credit_note`, `receivables_discount_reminder`, `receivables_final_reminder`, `payables_purchase_order`, `payables_notify_approver`, `payables_notify_payer` - `type__in` (enum, optional) - Allowed values: `receivables_quote`, `receivables_invoice`, `receivables_paid_invoice`, `receivables_credit_note`, `receivables_discount_reminder`, `receivables_final_reminder`, `payables_purchase_order`, `payables_notify_approver`, `payables_notify_payer` - `type__not_in` (enum, optional) - Allowed values: `receivables_quote`, `receivables_invoice`, `receivables_paid_invoice`, `receivables_credit_note`, `receivables_discount_reminder`, `receivables_final_reminder`, `payables_purchase_order`, `payables_notify_approver`, `payables_notify_payer` - `is_default` (boolean, optional) - `name` (string, optional) - `name__iexact` (string, optional) - `name__contains` (string, optional) - `name__icontains` (string, optional) ### Headers - `x-monite-version` (string, required) ## Response ### 200 Successful Response - `data` (list of CustomTemplateDataSchema, required) — All user-defined email templates - `next_pagination_token` (string, optional) — A token that can be sent in the `pagination_token` query parameter to get the next page of results, or `null` if there is no next page (i.e. you've reached the last page). - `prev_pagination_token` (string, optional) — A token that can be sent in the `pagination_token` query parameter to get the previous page of results, or `null` if there is no previous page (i.e. you've reached the first page). ## Errors ### 422 Get Mail Templates Request Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ### 500 Get Mail Templates Request Internal Server Error Internal Server Error - `error` (ErrorSchema, required) ## Types ### CustomTemplateDataSchema - `id` (string, required) — ID of email template - `created_at` (datetime, required) — Template created date and time - `updated_at` (datetime, required) — Template updated date and time - `body_template` (string, required) — Jinja2 compatible email body template - `is_default` (boolean, required) — Is default template - `language` (string, required) — Lowercase ISO code of language - `name` (string, required) — Name of the template - `subject_template` (string, required) — Jinja2 compatible email subject template - `type` (string, required) — Document type of content ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### ErrorSchema - `message` (string, required) ### ValidationErrorLocItem ## Examples **Response** ```json { "data": [ { "id": "id", "created_at": "2024-01-15T09:30:00Z", "updated_at": "2024-01-15T09:30:00Z", "body_template": "body_template", "is_default": true, "language": "language", "name": "name", "subject_template": "subject_template", "type": "type" } ], "next_pagination_token": "next_pagination_token", "prev_pagination_token": "prev_pagination_token" } ``` **SDK Code** ```python import requests url = "https://api.sandbox.monite.com/v1/mail_templates" headers = { "x-monite-version": "2024-01-31", "Authorization": "Bearer " } response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.sandbox.monite.com/v1/mail_templates'; const options = { method: 'GET', headers: {'x-monite-version': '2024-01-31', Authorization: 'Bearer '} }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.sandbox.monite.com/v1/mail_templates" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-monite-version", "2024-01-31") req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.sandbox.monite.com/v1/mail_templates") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["x-monite-version"] = '2024-01-31' request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.sandbox.monite.com/v1/mail_templates") .header("x-monite-version", "2024-01-31") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.sandbox.monite.com/v1/mail_templates', [ 'headers' => [ 'Authorization' => 'Bearer ', 'x-monite-version' => '2024-01-31', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sandbox.monite.com/v1/mail_templates"); var request = new RestRequest(Method.GET); request.AddHeader("x-monite-version", "2024-01-31"); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "x-monite-version": "2024-01-31", "Authorization": "Bearer " ] let request = NSMutableURLRequest(url: NSURL(string: "https://api.sandbox.monite.com/v1/mail_templates")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```