Email Template Metadata Endpoint

Get metadata information about an email template, including its variables and other attributes.

Endpoint

GET /api/v1/email/{templateId}/metadata

Authentication

All requests require a Bearer token in the Authorization header:

Authorization: Bearer your_api_token

Request

URL Parameters

  • templateId (required): The public ID of your email template

Body

No body required for this endpoint.

Response

Success Response (200 OK)

  • Content-Type: application/json
  • Body: JSON object containing template metadata
{
  "data": {
    "type": "email_template",
    "id": "template_public_id",
    "attributes": {
      "title": "Welcome Email",
      "subject": "Welcome to Our Platform",
      "variables": ["FIRST_NAME", "COMPANY_NAME"],
      "createdAt": "2024-01-20T10:00:00.000Z",
      "updatedAt": "2024-01-21T15:30:00.000Z"
    },
    "links": {
      "self": "/api/v1/email/template_public_id/metadata",
      "html": "/api/v1/email/template_public_id"
    }
  }
}

Response Fields

  • type: Always "email_template"
  • id: The public ID of the template
  • attributes:
    • title: The template's display name
    • subject: The email subject line
    • variables: Array of variable names used in the template
    • createdAt: ISO 8601 timestamp of template creation
    • updatedAt: ISO 8601 timestamp of last template update
  • links:
    • self: URL to this metadata endpoint
    • html: URL to get the rendered HTML version

Error Responses

| Status | Code            | Description                      |
| ------ | --------------- | -------------------------------- |
| 400    | MISSING_ID      | Template ID is required          |
| 401    | MISSING_AUTH    | Authorization header is required |
| 401    | INVALID_AUTH    | Invalid or inactive API token    |
| 404    | EMAIL_NOT_FOUND | Template not found               |
| 500    | INTERNAL_ERROR  | Unexpected server error          |

Error Response Format

{
  "error": {
    "status": 400,
    "title": "Missing ID",
    "detail": "Email template ID is required",
    "code": "MISSING_ID"
  }
}

Usage

This endpoint is useful for:

  • Discovering what variables are required for a template
  • Getting template metadata before rendering
  • Checking template modification dates
  • Getting links to related endpoints

Usage Limits

  • This endpoint does not consume any credits
  • Rate limits may apply based on your plan