Skip to main content
PATCH
/
api
/
reports
/
{id}
Update a report
curl --request PATCH \
  --url https://clarus-api.com/api/reports/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "data": {
    "type": "reports",
    "attributes": {
      "description": "<string>",
      "name": "<string>",
      "report_fields": [
        {
          "name": "<string>",
          "path": "<string>",
          "prefix": "<string>",
          "suffix": "<string>"
        }
      ],
      "report_query_id": 123,
      "source_path": "<string>",
      "variables": [
        {
          "name": "<string>",
          "value": "<string>",
          "prompt": "<string>",
          "operator": "<string>"
        }
      ]
    }
  }
}
'
{
  "data": {
    "id": 123,
    "type": "reports",
    "attributes": {
      "name": "Count of Tasks Left To Do",
      "description": "Count of Tasks Left To Do by Task Type",
      "report_type": "bar",
      "report_query_id": 1,
      "source_path": "data.tasks.aggregation",
      "report_fields": [
        {
          "name": "Task Type",
          "path": "task_type.code"
        },
        {
          "name": "Tasks Left To Do",
          "path": "total_records"
        }
      ],
      "variables": [
        {
          "name": "created_at_from",
          "value": "start of today",
          "prompt": "true"
        },
        {
          "name": "created_at_to",
          "value": "end of today",
          "prompt": "true"
        }
      ]
    }
  }
}

Request Structure

{
  "data": {
    "type": "reports",
    "attributes": {
      "name": "Updated Stock Report",
      "description": "Updated description",
      "variables": [
        { "name": "date_from", "value": "beginning of month", "prompt": "Date From", "operator": ">=" }
      ]
    }
  }
}

Key Fields

FieldRequiredDescription
nameNoUpdated report name
descriptionNoUpdated description
report_typeNoUpdated output type
report_fieldsNoUpdated field definitions
variablesNoUpdated variable values

Access Control

Only the report owner can update it. Returns 403 if the authenticated user is not the owner.

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.

Path Parameters

id
integer
required

The unique identifier of the report to update

Body

application/json
data
object
required

Response

Report updated successfully

data
object