Settlements

Use this view endpoint to retrieve settlement transaction data at a specified aggregation level. For example, if you choose an aggregation level of detail, each row represents a single settlement transaction. The data is derived from the transaction-related messages sent to and from the Marqeta platform.

This endpoint supports multiple response formats, query filtering, field filtering, sorting, pagination, and currency conversion. For more information about response options, see Response Customization.

Retrieve settlement data (JSON)

Action: GET
Endpoint: /views/settlements/{time_agg}

Retrieve settlements transaction data, aggregated over the specified time period. This endpoint returns a JSON object that contains an array of records matching your filter query.

Path parameters

Name Type Required? Description Allowable Values
time_agg string Yes Time period over which to aggregate the data. For more information, see Data aggregation levels. detail | day | week | month

Sample response body

The following sample shows a representative response for a GET request to the views/settlements/day?program=my_program&fields=post_date,currency_conversion_fees endpoint.

{
"total": 2,
"is_more": false,
"count": 2,
"info": {},
"start_date": "2018-02-08T00:00:00+0000",
"end_date": "2018-02-09T00:00:00+0000",
"last_run_time": "2018-02-09T18:03:19Z",
"schema": [
{
"field": "post_date",
"type": "date",
"display": "Post Date",
"units": null,
"has_total": false,
"date_format": "YYYY-MM-DD",
"is_filter_only": false
},
{
"field": "currency_conversion_fees",
"type": "numeric(14,2)",
"display": "Currency Conversion Fees",
"units": null,
"has_total": false,
"is_filter_only": false
}
],
"records": [
{
"post_date": "2018-02-09T00:00:00.000Z",
"currency_conversion_fees": 4.94
},
{
"post_date": "2018-02-08T00:00:00.000Z",
"currency_conversion_fees": 0.56
}
]
}


Retrieve settlement data (file export)

Action: GET
Endpoint: /views/settlements/{time_agg}/{export_type}

Retrieve settlements transaction data, aggregated over the specified time period. This endpoint asynchronously generates a file in the specified format and returns a job token for retrieving the file when it is completed. The file contains a list of records matching your filter query.

Path parameters

Name Type Required? Description Allowable Values
time_agg string Yes Time period over which to aggregate the data. For more information, see Data aggregation levels. detail | day | week | month
export_type string Yes File format in which to export the data. csv | xlsx

Query parameters

Name Type Required? Description Allowable Values
compress string No Type of file compression for the exported file. gz | zip

Default: gz

Sample response body

{
"token":"111122226c444d8888888a9999ae11111db63da4.csv.gz"
}


Retrieve settlement schema

Action: GET
Endpoint: /views/settlements/{time_agg}/schema

Retrieve a JSON representation of the settlements view schema for data aggregated over the specified time period. The schema object contains an array of objects that describe the available columns and the data type of each column.

Path parameters

Name Type Required? Description Allowable Values
time_agg string Yes Time period over which to aggregate the data. For more information, see Data aggregation levels. detail | day | week | month

Sample response body

The following sample shows a representative response for a GET request to the /views/settlements/detail/schema?program=my_program endpoint. The schema can vary based on the data aggregation level and the data you are authorized to access (based on the credentials you provide in your request).

[
    {
        "field": "program",
        "type": "character varying(128)",
        "display": "Program",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "transaction_token",
        "type": "integer",
        "display": "Transaction Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "post_date",
        "type": "date",
        "display": "Post Date",
        "units": null,
        "has_total": false,
        "date_format": "YYYY-MM-DD HH:mm:ss",
        "is_filter_only": false
    },
    {
        "field": "initiating_transaction_token",
        "type": "integer",
        "display": "Initiating Transaction Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "reference_transaction_token",
        "type": "integer",
        "display": "Reference Transaction Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "reversal_transaction_token",
        "type": "integer",
        "display": "Reversal Transaction Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "transaction_type",
        "type": "character varying(128)",
        "display": "Transaction Type",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "transaction_status",
        "type": "character varying(128)",
        "display": "Transaction Status",
        "enum_values": [
            "Approved or completed successfully",
            "Clear Settlement",
            "Cleared Return",
            "Forced Post Settlement",
            "Program User Fee",
            "Rejected Sig Settlement",
            "Reversal",
            "Settled Authorization",
            "Successful PIN Transaction",
            "Successful Pin Transaction",
            "unknown"
        ],
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "transaction_processing_type",
        "type": "character varying(128)",
        "display": "Transaction Processing Type",
        "enum_values": [
            "ATM",
            "Atm",
            "CHIP",
            "CHIP_FALLBACK",
            "Chip",
            "Chip_Fallback",
            "Digital Wallet Token",
            "ECOMMERCE",
            "Ecommerce",
            "MAGSTRIPE",
            "Magstripe",
            "OTHER",
            "Other",
            "UNKNOWN",
            "Undefined",
            "Unknown"
        ],
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "parent_user_token",
        "type": "character varying(128)",
        "display": "Parent User Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "parent_uai",
        "type": "character varying(50)",
        "display": "Parent Uai",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "acting_user_token",
        "type": "character varying(128)",
        "display": "Acting User Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "acting_uai",
        "type": "character varying(50)",
        "display": "Acting Uai",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "business_name",
        "type": "character varying(128)",
        "display": "Business Name",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "acting_card_token",
        "type": "character varying(128)",
        "display": "Acting Card Token",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "acting_card_product",
        "type": "character varying(100)",
        "display": "Acting Card Product",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "card_type",
        "type": "character varying(128)",
        "display": "Card Type",
        "enum_values": [
            "Physical",
            "Physical Contactless",
            "Physical Icc",
            "Physical Msr",
            "Virtual",
            "Virtual Pan"
        ],
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant",
        "type": "character varying(128)",
        "display": "Merchant",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant_country",
        "type": "character varying(128)",
        "display": "Merchant Country",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant_state",
        "type": "character varying(128)",
        "display": "Merchant State",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant_city",
        "type": "character varying(128)",
        "display": "Merchant City",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "network",
        "type": "character varying(128)",
        "display": "Network",
        "enum_values": [
            "Discover",
            "Mastercard",
            "Other",
            "Pulse",
            "Visa"
        ],
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "sub_network",
        "type": "character varying(128)",
        "display": "Sub Network",
        "enum_values": [
            "Discover",
            "Interlink",
            "Maestro",
            "Mastercard",
            "Netdebit",
            "Other",
            "Plus",
            "Pulse",
            "Visanet"
        ],
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "clean_merchant",
        "type": "character varying(128)",
        "display": "Clean Merchant",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant_category_code",
        "type": "bigint",
        "display": "Merchant Category Code",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant_category_code_group",
        "type": "character varying(2000)",
        "display": "Merchant Category Code Group",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "merchant_category_code_description",
        "type": "character varying(1000)",
        "display": "Merchant Category Code Description",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "standin_approved_by",
        "type": "character varying(128)",
        "display": "Standin Approved By",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "token_requestor",
        "type": "character varying(30)",
        "display": "Token Requestor",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "token_type",
        "type": "character varying(30)",
        "display": "Token Type",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "token_device_location",
        "type": "character varying(50)",
        "display": "Token Device Location",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "currency",
        "type": "character varying(10)",
        "display": "Currency",
        "units": null,
        "has_total": false,
        "is_filter_only": false
    },
    {
        "field": "purchases",
        "type": "numeric(14,2)",
        "display": "Purchases",
        "units": null,
        "has_total": true,
        "is_filter_only": false
    },
    {
        "field": "returns",
        "type": "numeric(14,2)",
        "display": "Returns",
        "units": null,
        "has_total": true,
        "is_filter_only": false
    },
    {
        "field": "pin_debit_assoc_fees",
        "type": "numeric(14,2)",
        "display": "Pin Debit Assoc Fees",
        "units": null,
        "has_total": true,
        "is_filter_only": false
    },
    {
        "field": "currency_conversion_fees",
        "type": "numeric(14,2)",
        "display": "Currency Conversion Fees",
        "units": null,
        "has_total": true,
        "is_filter_only": false
    },
    {
        "field": "last_modified_time",
        "type": "timestamp without time zone",
        "display": "Last Modified Time",
        "units": null,
        "has_total": false,
        "date_format": "YYYY-MM-DD HH:mm:ss",
        "is_filter_only": false
    }
]