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

# Get Freshness Status

> Retrieve freshness status for an asset or data source

<div aria-hidden="true" style={{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap"}}>For LLM agents: documentation index at <a href="/llms.txt" tabIndex={-1}>/llms.txt</a>, full text at <a href="/llms-full.txt" tabIndex={-1}>/llms-full.txt</a>. Append .md to any page URL for plain markdown.</div>

Check whether data is fresh or stale. Use this to gate pipelines, build monitoring dashboards, or verify SLA compliance.

## When to Use

* **Pipeline gating**: Fail jobs if upstream data is stale
* **Dashboards**: Show freshness status in monitoring tools
* **SLA tracking**: Verify data meets freshness requirements
* **Alerting integration**: Build custom alert workflows

## SDK & CLI Examples

<CodeGroup>
  ```python Python SDK theme={null}
  from anomalyarmor import Client
  from anomalyarmor.exceptions import StalenessError

  client = Client(api_key="aa_live_xxx")

  # Check freshness for a single asset
  freshness = client.freshness.get("snowflake.prod.public.orders")
  print(f"Status: {freshness.status}")
  print(f"Last updated: {freshness.last_updated}")
  print(f"SLA threshold: {freshness.sla_threshold}")

  # Require fresh data (raises StalenessError if stale)
  try:
      client.freshness.require_fresh("snowflake.prod.public.orders")
      print("Data is fresh, safe to proceed")
  except StalenessError as e:
      print(f"Data is stale! Last update: {e.last_updated}")
  ```

  ```bash CLI theme={null}
  # Check freshness
  anomalyarmor freshness check snowflake.prod.public.orders

  # Output as JSON
  anomalyarmor freshness check snowflake.prod.public.orders --format json
  ```
</CodeGroup>

## Parameters

| Parameter  | Type   | Description                |
| ---------- | ------ | -------------------------- |
| `asset_id` | string | Asset ID or qualified name |

## Response

```json theme={null}
{
  "asset": "snowflake.prod.public.orders",
  "status": "fresh",
  "last_updated": "2024-01-15T08:30:00Z",
  "sla_threshold": "2h",
  "sla_status": "within_sla",
  "checked_at": "2024-01-15T09:00:00Z",
  "timestamp_column": "created_at",
  "data_age_minutes": 30
}
```

## Response Fields

| Field              | Description                                  |
| ------------------ | -------------------------------------------- |
| `status`           | `fresh`, `stale`, or `unknown`               |
| `last_updated`     | Timestamp of most recent data in the table   |
| `sla_threshold`    | Configured freshness SLA (e.g., "2h", "24h") |
| `sla_status`       | `within_sla`, `warning`, or `violated`       |
| `checked_at`       | When this freshness check ran                |
| `timestamp_column` | Column used to determine freshness           |
| `data_age_minutes` | How old the data is in minutes               |

## Status Values

| Status    | Meaning                                   |
| --------- | ----------------------------------------- |
| `fresh`   | Data updated within SLA threshold         |
| `stale`   | Data older than SLA threshold             |
| `unknown` | No timestamp column configured or no data |

## Error Responses

| Status | Meaning                                   |
| ------ | ----------------------------------------- |
| `401`  | Invalid or missing API key                |
| `404`  | Asset not found                           |
| `422`  | No freshness configuration for this asset |
| `429`  | Rate limit exceeded                       |


## OpenAPI

````yaml GET /api/v1/assets/{asset_id}/freshness
openapi: 3.1.0
info:
  title: AnomalyArmor API
  description: |2-

        ## AnomalyArmor Security Platform API

        This API provides comprehensive database monitoring and schema change detection capabilities.

        ### Key Features
        - **Multi-Database Support**: PostgreSQL, MySQL, Databricks, Snowflake, Redshift, SQLite
        - **Schema Discovery**: Automated schema detection and metadata capture
        - **Change Detection**: Real-time schema drift monitoring with severity classification
        - **Connection Testing**: Live database connectivity validation
        - **Multi-Tenant**: Company-isolated data with role-based access control

        ### Authentication
        All endpoints require JWT authentication. Use `/auth/login` to obtain tokens.

        ### Rate Limits
        - Authentication: 5 req/min
        - Asset operations: 100 req/min
        - Schema discovery: 10 req/hour per asset

        ### Support
        - **Documentation**: Available at `/docs` (this page) and `/redoc`
        - **Health Check**: `/api/v1/health`
        - **OpenAPI Spec**: `/openapi.json`
        
  contact:
    name: AnomalyArmor Support
    url: https://anomalyarmor.ai/support
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: http://localhost:8000
    description: Development server
  - url: https://api.anomalyarmor.ai
    description: Production server
security: []
paths:
  /api/v1/assets/{asset_id}/freshness:
    get:
      tags:
        - freshness
      summary: Get Asset Freshness Overview
      description: |-
        Get freshness overview for an asset with pagination and filtering.

        Returns comprehensive freshness monitoring data including:
        - Summary statistics (total tables, ready/not-ready counts)
        - Individual table freshness status (paginated)
        - Active monitoring schedules
        - Detected patterns

        Query Parameters:
        - limit: Maximum tables to return (default: 20, max: 100)
        - offset: Number of tables to skip (default: 0)
        - status_filters: Filter by status (ready,not_ready,unknown,error)
        - schema_filters: Filter by schema names
        - tag_filters: Filter by tag names
        - search_query: Search in table names and paths
      operationId: get_asset_freshness_overview_api_v1_assets__asset_id__freshness_get
      parameters:
        - name: asset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Asset Id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Maximum tables to return
            default: 20
            title: Limit
          description: Maximum tables to return
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Number of tables to skip
            default: 0
            title: Offset
          description: Number of tables to skip
        - name: status_filters
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Comma-separated status filters (ready,not_ready,unknown,error)
            title: Status Filters
          description: Comma-separated status filters (ready,not_ready,unknown,error)
        - name: schema_filters
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Comma-separated schema filters
            title: Schema Filters
          description: Comma-separated schema filters
        - name: tag_filters
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Comma-separated tag filters
            title: Tag Filters
          description: Comma-separated tag filters
        - name: search_query
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Search query for table names
            title: Search Query
          description: Search query for table names
        - name: Authorization
          in: header
          required: false
          schema:
            type: string
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    StandardResponse:
      properties:
        success:
          type: boolean
          title: Success
        data:
          anyOf:
            - {}
            - type: 'null'
          title: Data
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      type: object
      required:
        - success
      title: StandardResponse
      description: Standard API response wrapper.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````