> ## Documentation Index
> Fetch the complete documentation index at: https://credira.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Email Templates

> Retrieve email templates for an account

Retrieve all email templates associated with a specific account ID.

<Note>
  This endpoint returns all available email templates for the specified account,
  including both active and inactive templates.
</Note>

## Request

<ParamField query="account_id" type="string" required>
  The unique identifier of the account to retrieve email templates for
</ParamField>

<ParamField query="status" type="string">
  Filter templates by status. Possible values: `active`, `inactive`, `draft`
</ParamField>

<ParamField query="category" type="string">
  Filter templates by category. Possible values: `payment_reminder`,
  `follow_up`, `welcome`, `notification`, `marketing`
</ParamField>

<ParamField header="Authorization" type="string" required>
  Bearer token for API authentication
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
       --url https://api.credira.com/v1/email-templates?account_id=acc_987654321 \
       --header 'Authorization: Bearer YOUR_API_KEY' \
       --header 'Content-Type: application/json'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    "https://api.credira.com/v1/email-templates?account_id=acc_987654321",
    {
      method: "GET",
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
      },
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample status="200" summary="Success">
  ```json theme={null}
  {
    "success": true,
    "data": [
      {
        "id": "template_123456789",
        "account_id": "acc_987654321",
        "name": "Payment Reminder Template",
        "subject": "Payment Reminder - Invoice #{{invoice_number}}",
        "category": "payment_reminder",
        "status": "active",
        "html_content": "<html><body><h1>Payment Reminder</h1><p>Dear {{customer_name}},</p><p>This is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.</p><p>Please make your payment as soon as possible.</p><p>Best regards,<br>Credira Team</p></body></html>",
        "text_content": "Payment Reminder\n\nDear {{customer_name}},\n\nThis is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.\n\nPlease make your payment as soon as possible.\n\nBest regards,\nCredira Team",
        "variables": ["customer_name", "invoice_number", "amount", "due_date"],
        "created_time": "2024-01-15T10:30:00Z",
        "updated_time": "2024-01-15T10:30:00Z",
        "created_by": "user_456789123",
        "usage_count": 150,
        "last_used": "2024-01-15T09:30:00Z",
        "metadata": {
          "department": "billing",
          "priority": "high",
          "tags": ["payment", "reminder", "invoice"]
        }
      }
    ],
    "meta": {
      "timestamp": "2024-01-15T10:30:00Z",
      "request_id": "req_123456789",
      "total_templates": 1
    }
  }
  ```
</ResponseExample>

<ResponseExample status="400" summary="Bad Request">
  ```json theme={null}
  {
    "success": false,
    "error": {
      "code": "INVALID_REQUEST",
      "message": "Missing required parameter: account_id"
    },
    "meta": {
      "timestamp": "2024-01-15T10:30:00Z",
      "request_id": "req_123456789"
    }
  }
  ```
</ResponseExample>

<ResponseExample status="401" summary="Unauthorized">
  ```json theme={null}
  {
    "success": false,
    "error": {
      "code": "UNAUTHORIZED",
      "message": "Invalid or missing API key"
    },
    "meta": {
      "timestamp": "2024-01-15T10:30:00Z",
      "request_id": "req_123456789"
    }
  }
  ```
</ResponseExample>

<ResponseExample status="404" summary="Not Found">
  ```json theme={null}
  {
    "success": false,
    "error": {
      "code": "NOT_FOUND",
      "message": "Account not found"
    },
    "meta": {
      "timestamp": "2024-01-15T10:30:00Z",
      "request_id": "req_123456789"
    }
  }
  ```
</ResponseExample>

<ResponseExample status="429" summary="Too Many Requests">
  ```json theme={null}
  {
    "success": false,
    "error": {
      "code": "RATE_LIMITED",
      "message": "Rate limit exceeded"
    },
    "meta": {
      "timestamp": "2024-01-15T10:30:00Z",
      "request_id": "req_123456789"
    }
  }
  ```
</ResponseExample>
