---
title: "Calculate age"
url: "https://developers.zinnia.com/apis/illustration-3-0-8/versions/b96a49c1-73c5-46d3-8968-fe603081d524/operations/calculate-age"
---

> Full API specification: https://developers.zinnia.com/apis/illustration-3-0-8/versions/b96a49c1-73c5-46d3-8968-fe603081d524.md

# Calculate age

`POST` `/illustration/v3/utility/calculateAge`

Operation ID: `calculate-age`

Calculates age based on date of birth and as-of date using specified calculation method

## Request body (required)

Content types: `application/json`

## Responses

- `200` - Age calculation completed successfully
- `400` - The request was malformed
- `500` - An unexpected processing error occurred

## OpenAPI definition

```yaml
openapi: 3.0.1
info:
  title: Illustration Generation
  version: 3.5.3
servers:
  - url: https://dev.api.zinnia.io
    description: Development
paths:
  /illustration/v3/utility/calculateAge:
    post:
      operationId: calculate-age
      summary: Calculate age
      description: Calculates age based on date of birth and as-of date using
        specified calculation method
      requestBody:
        description: Age calculation request containing date of birth, as-of date, and
          calculation method
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Age-Calculation-Request"
      responses:
        "200":
          description: Age calculation completed successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Age-Calculation-Response"
        "400":
          description: The request was malformed
        "500":
          description: An unexpected processing error occurred
      security:
        - Auth0: []
      tags:
        - Utility
security:
  - Auth0: []
components:
  schemas:
    Age-Calculation-Request:
      type: object
      required:
        - dateOfBirth
        - asOfDate
        - calculationMethod
      properties:
        dateOfBirth:
          type: string
          format: date
          description: Date of birth in ISO-8601 format
          example: 1990-08-25
        asOfDate:
          type: string
          format: date
          description: As-of date in ISO-8601 format
          example: 2025-08-25
        calculationMethod:
          $ref: "#/components/schemas/Age-Calculation-Method"
    Age-Calculation-Response:
      type: object
      properties:
        age:
          type: integer
          description: Calculated age
          example: 35
        monthsSinceLastBirthday:
          type: integer
          description: Number of months since last birthday
          example: 0
    Age-Calculation-Method:
      type: string
      enum:
        - AGE_LAST
        - AGE_NEAREST
      description: Age calculation method - AGE_LAST for age at last birthday,
        AGE_NEAREST for age at nearest birthday
      example: AGE_LAST
  securitySchemes:
    Auth0:
      type: openIdConnect
      openIdConnectUrl: https://login.dev.zinnia.com/.well-known/openid-configuration
      x-kong-security-openid-connect:
        config:
          run_on_preflight: true
          scopes_claim:
            - https://dev.api.zinnia.io/permissions
          audience_claim:
            - aud
          audience_required:
            - https://dev.api.zinnia.io
          auth_methods:
            - bearer
          scopes: []
        enabled: true
        protocols:
          - grpc
          - grpcs
          - http
          - https
```
