Skip to main content
POST
/
api
/
scheduled_reports
Create a scheduled report
curl --request POST \
  --url https://clarus-api.com/api/scheduled_reports \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "data": {
    "type": "scheduled_reports",
    "attributes": {
      "name": "Daily Task Report",
      "frequency": "Day",
      "numbers": [
        1,
        2,
        3,
        4,
        5,
        6,
        7
      ],
      "time": "02:00",
      "subject": "Daily Task Report",
      "body": "Please find the daily task report attached."
    },
    "relationships": {
      "scheduled-report-reports": {
        "data": [
          {
            "attributes": {
              "report_id": 1
            }
          }
        ]
      },
      "scheduled-report-recipients": {
        "data": [
          {
            "attributes": {
              "email_address": "[email protected]",
              "name": "Warehouse Manager"
            }
          }
        ]
      }
    }
  }
}
'
{
  "data": {
    "id": 123,
    "type": "scheduled_reports",
    "attributes": {
      "name": "Weekly Stock Report",
      "frequency": "Day",
      "numbers": [
        1,
        3,
        5
      ],
      "time": "09:00",
      "subject": "Weekly Stock Report",
      "body": "Please find the weekly stock report attached."
    }
  }
}

Request Structure

Scheduled reports use JSON:API format with embedded relationships:
{
  "data": {
    "type": "scheduled_reports",
    "attributes": {
      "name": "Weekly Stock Report",
      "frequency": "Day",
      "numbers": [1, 3, 5],
      "time": "09:00",
      "subject": "Weekly Stock Report",
      "body": "Please find the weekly stock report attached."
    },
    "relationships": {
      "scheduled-report-reports": {
        "data": [
          {
            "attributes": {
              "report_id": 1,
              "variables": [
                { "name": "date_from", "value": "today 00:00:00" }
              ]
            }
          }
        ]
      },
      "scheduled-report-recipients": {
        "data": [
          {
            "attributes": {
              "email_address": "[email protected]",
              "name": "Warehouse Manager"
            }
          }
        ]
      },
      "scheduled-report-ftp-recipients": {
        "data": [
          {
            "attributes": {
              "ftp_user_id": 5
            }
          }
        ]
      }
    }
  }
}

Key Fields

FieldRequiredDescription
nameYesSchedule name (max 50 chars)
frequencyYesDay (days of the week) or Month (days of the month)
numbersYesArray of integers — day numbers when schedule runs
timeYesTime of day to run (e.g., 09:00)
subjectNoEmail subject line (max 256 chars)
bodyNoEmail body text

Frequency & Numbers

  • Day frequency: numbers 1-7 (1 = Monday, 7 = Sunday)
  • Month frequency: numbers 1-31 (day of month)

Relationships

Relationship keys use kebab-case in the JSON:API relationships object:
RelationshipDescription
scheduled-report-reportsReports to generate (each with optional variable overrides)
scheduled-report-recipientsEmail recipients
scheduled-report-ftp-recipientsFTP destinations

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Body

application/json
data
object
required

Response

Scheduled report created successfully

data
object