POST
/
reports
C#
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;

var sdk = new Gr4vySDK(
    id: "example",
    server: SDKConfig.Server.Sandbox,
    bearerAuthSource: Auth.WithToken(privateKey),
    merchantAccountId: "default"
);

var res = await sdk.Reports.CreateAsync(reportCreate: new ReportCreate() {
    Name = "Monthly Transaction Report",
    Schedule = "<value>",
    ScheduleEnabled = true,
    ScheduleTimezone = "UTC",
    Spec = Spec.CreateAccountsReceivables(
        new AccountsReceivablesReportSpec() {
            Params = new Dictionary<string, object>() {
                { "filters", new Dictionary<string, object>() {
                    { "timestamp", new Dictionary<string, object>() {
                        { "end", "2024-05-31T23:59:59Z" },
                        { "start", "2024-05-01T00:00:00Z" },
                    } },
                } },
            },
        }
    ),
});

// handle response
{
  "type": "report",
  "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
  "merchant_account_id": "merchant-account-12345",
  "name": "Monthly Transaction Report",
  "creator_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "creator_display_name": "Jane Doe",
  "creator_type": "user",
  "created_at": "2024-05-30T12:34:56.000Z",
  "updated_at": "2024-05-30T13:00:00.000Z",
  "next_execution_at": "2024-06-01T00:00:00.000Z",
  "description": "Monthly transaction summary for May 2024.",
  "schedule": "daily",
  "schedule_enabled": true,
  "schedule_timezone": "UTC",
  "spec": {
    "model": "transactions",
    "params": {
      "fields": [
        "id",
        "status"
      ],
      "filters": {
        "status": [
          "succeeded"
        ]
      }
    }
  },
  "latest_execution": {
    "type": "report-execution",
    "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
    "created_at": "2024-05-30T12:34:56.000Z",
    "updated_at": "2024-05-30T13:00:00.000Z",
    "status": "completed",
    "context": {
      "reference_timestamp": "2024-05-30T12:34:56.000Z",
      "reference_timezone": "UTC"
    }
  }
}
This endpoint requires the reports.write scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-gr4vy-merchant-account-id
string | null

The ID of the merchant account to use for this request.

Examples:

"default"

Body

application/json
name
string
required

The name of the report.

Required string length: 1 - 100
Examples:

"Monthly Transaction Report"

schedule
enum<string>
required

The schedule for the report.

Available options:
daily,
monthly,
once,
weekly
Examples:

"daily"

schedule_enabled
boolean
required

Whether the report schedule is enabled.

Examples:

true

spec
object
required

The report specification.

description
string | null

A description of the report.

Required string length: 1 - 1000
Examples:

"Monthly transaction summary for May 2024."

schedule_timezone
string
default:Etc/UTC

The timezone for the report schedule.

Examples:

"UTC"

Response

Successful Response

id
string<uuid>
required

The unique ID for the report.

Examples:

"a1b2c3d4-5678-90ab-cdef-1234567890ab"

merchant_account_id
string
required

The merchant account ID this report belongs to.

Examples:

"merchant-account-12345"

name
string
required

The name of the report.

Required string length: 1 - 100
Examples:

"Monthly Transaction Report"

created_at
string<date-time>
required

The date this report was created at.

Examples:

"2024-05-30T12:34:56.000Z"

updated_at
string<date-time>
required

The date this report was last updated.

Examples:

"2024-05-30T13:00:00.000Z"

schedule
enum<string>
required

The schedule for the report.

Available options:
daily,
monthly,
once,
weekly
Examples:

"daily"

schedule_enabled
boolean
required

Whether the report schedule is enabled.

Examples:

true

schedule_timezone
string
required

The timezone for the report schedule.

Examples:

"UTC"

spec
object
required

The report specification.

type
string
default:report

Always report.

Allowed value: "report"
Examples:

"report"

creator_id
string<uuid> | null

The ID of the user who created the report.

Examples:

"d290f1ee-6c54-4b01-90e6-d701748f0851"

creator_display_name
string | null

The display name of the report creator.

Required string length: 1 - 1000
Examples:

"Jane Doe"

creator_type
enum<string> | null

The type of the report creator.

Available options:
user,
private_key
Examples:

"user"

next_execution_at
string<date-time> | null

The next scheduled execution time for the report.

Examples:

"2024-06-01T00:00:00.000Z"

description
string | null

A description of the report.

Required string length: 1 - 1000
Examples:

"Monthly transaction summary for May 2024."

latest_execution
object | null

The latest execution summary for the report.