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

# Exploring the DiVA API

> Learn about DiVA API endpoints.

The DiVA API provides several endpoints that enable you to monitor your business progress and perform other essential business operations. Once you have your DiVA API tokens, you can use a tool such as Postman to explore and test the DiVA endpoints.

<h2 id="_setting_up_a_call_in_postman">
  Setting up a call in Postman
</h2>

Testing a DiVA endpoint using Postman is easy. To set up a call to a DiVA endpoint:

<Steps>
  <Step>
    Specify the endpoint you want to test. For example, to get the settlements for the current week, use the program short name in the following URL:\
    `https://diva-api.marqeta.com/data/v2/views/settlements/day?program=my_program`
  </Step>

  <Step>
    Select **GET**.
  </Step>

  <Step>
    Set up authentication by selecting an authorization type in the Authorization area and entering your tokens. For more information, see [Authentication](/diva-api/authentication/).
  </Step>

  <Step>
    Select **Send**. Your response appears in the output window.
  </Step>
</Steps>

<h2 id="_refining_the_response">
  Refining the response
</h2>

You can customize your response by using query and field filters, sorting and pagination, aggregation, and grouping.

<h3 id="_aggregation">
  Aggregation
</h3>

The example request in the previous section aggregates the result for the current day. Most DiVA requests can be also be viewed in a detailed format, or aggregated by week or month. For example, you can alter the request to get the response data aggregated for the current week as follows:

`https://diva-api.marqeta.com/data/v2/views/settlements/week?program=my_program`

For more details on aggregation levels, see [Data Aggregation Levels](/diva-api/response-customization/#_data_aggregation_levels).

<h3 id="_filters">
  Filters
</h3>

You can filter your results using query filtering or field filtering. To filter the fields to include in the response, specify those fields in the request. For example, if you append `post_date`, `settlement_date`, `transaction_type` and `network` to the `GET` request as shown below, only those fields are returned in the response:

`https://diva-api.marqeta.com/data/v2/views/settlements/week?program=my_program&fields=post_date,settlement_date,transaction_type,network`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 198,
    "is_more": false,
    "count": 198,
    "info": {},
    "start_date": "2019-08-19T00:00:00+0000",
    "end_date": "2019-09-18T00:00:00+0000",
    "last_run_time": "2019-09-04T16:09:22Z",
    "schema": [
        {
            "field": "post_date",
            "type": "date",
            "description": "The date a transaction was posted by the network.",
            "display": "Post Date",
            "units": null,
            "has_total": false,
            "date_format": "YYYY-MM-DD",
            "is_filter_only": false
        },
        {
            "field": "settlement_date",
            "type": "date",
            "description": "A date field provided by pin networks when a pindebit transaction occurs. This date is typically represented as the date in which the pin network expects that pin transaction to settle so it is usually forward dated 1 or days.",
            "display": "Settlement Date",
            "units": null,
            "has_total": false,
            "date_format": "YYYY-MM-DD",
            "is_filter_only": false
        },
        {
            "field": "transaction_type",
            "type": "character varying(128)",
            "description": "A type field that categorizes the transaction event.",
            "display": "Transaction Type",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "network",
            "type": "character varying(128)",
            "description": "The card network on which a transaction took place.",
            "display": "Network",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "post_date": "2019-09-18T00:00:00.000Z",
            "settlement_date": null,
            "transaction_type": "Cleared Returns",
            "network": "Visa"
        },
        {
            "post_date": "2019-09-18T00:00:00.000Z",
            "settlement_date": null,
            "transaction_type": "Forced Post Settlements",
            "network": "Pulse"
        },

        ...

        {
            "post_date": "2019-09-18T00:00:00.000Z",
            "settlement_date": null,
            "transaction_type": "Forced Post Settlements",
            "network": "Mastercard"
        }
    ]
}
```

For more on filtering fields, see [Field Filtering](/diva-api/response-customization/#_field_filtering). For information on filtering using queries, see [Query Filtering](/diva-api/response-customization/#_query_filtering).

<h3 id="_automating_jobs_based_on_updates">
  Automating jobs based on updates
</h3>

Use the `report_load_timestamp` field in key endpoints to configure your automated jobs to trigger based on updates. This timestamp is presented in UTC.

<h3 id="_other_customizations">
  Other customizations
</h3>

For more details and examples of customizing the response using sorting, pagination, aggregation, and grouping, see [Response Customization](/diva-api/response-customization/).

<h2 id="_useful_endpoints">
  Useful endpoints
</h2>

Curious which endpoints may be useful for monitoring and reporting on operations? This section summarizes some reporting needs addressed by the DiVA endpoints.

<h3 id="_reconciling_financial_transactions">
  Reconciling financial transactions
</h3>

For reconciling financial transactions, the `/programbalances` and `/programbalancessettlement` endpoints provide useful information. Ask your Marqeta Customer Service representative if you have questions about which data points are appropriate for your program.

<h4 id="_program_balances">
  Program balances
</h4>

The `/programbalances/day` endpoint includes the `beginning_bank_balance`, `amount_to_send`, and `ending_bank_balance` fields, which are key indicators of program activity. The following `GET` request returns relevant financial transaction information for the current day:

`https://diva-api.marqeta.com/data/v2/views/programbalances/day?program=my_program&fields=beginning_bank_balance,amount_to_send,ending_bank_balance`

The request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 16,
    "is_more": false,
    "count": 16,
    "info": {},
    "start_date": "2023-10-01T00:00:00+0000",
    "end_date": "2023-10-03T00:00:00+0000",
    "last_run_time": "2022-08-27T16:08:03Z",
    "schema": [
        {
            "field": "beginning_bank_balance",
            "type": "numeric(14,2)",
            "description": "#N/A",
            "display": "Beginning Bank Balance",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "amount_to_send",
            "type": "numeric(14,2)",
            "description": "The net amount of partner funds and JIT Funding loads: (Partner Funds Loads + Partner Funds Unloads + Partner Funds Adjustments) + (JIT Loads + JIT Unloads + JIT Adjustments)",
            "display": "Amount To Send",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "ending_bank_balance",
            "type": "numeric(14,2)",
            "description": "",
            "display": "Ending Bank Balance",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "beginning_bank_balance": 13721500.57,
            "amount_to_send": -2007425.14,
            "ending_bank_balance": 11714075.43
        },
        {
            "beginning_bank_balance": 10676468.56,
            "amount_to_send": -2069664.32,
            "ending_bank_balance": 10821608.44
        }

        ...

        {
            "beginning_bank_balance": 13883983.47,
            "amount_to_send": -2275955.87,
            "ending_bank_balance": 13721500.57
        }
    ]
}
```

<h4 id="_program_balances_settlement">
  Program balances settlement
</h4>

Using the `/programbalancessettlements/day` endpoint, you can retrieve balance data based on settlements. Each row represents the balance data, including bank balance and the amount to transfer to fund your program. For program balances settlement, the following `GET` request retrieves program balances settlement information for the current day:

`https://diva-api.marqeta.com/data/v2/views/programbalances/day?program=my_program&fields=beginning_bank_balance,partner_funds_loads_net,deposit,ending_bank_balance`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 16,
    "is_more": false,
    "count": 16,
    "info": {},
    "start_date": "2019-09-01T00:00:00+0000",
    "end_date": "2019-09-19T00:00:00+0000",
    "last_run_time": "",
    "schema": [
        {
            "field": "beginning_bank_balance",
            "type": "numeric(14,2)",
            "description": "#N/A",
            "display": "Beginning Bank Balance",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "partner_funds_loads_net",
            "type": "numeric(14,2)",
            "description": "The net amount of funds loaded or unloaded using a program funding account including any adjustments.",
            "display": "Partner Funds Loads Net",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "deposit",
            "type": "numeric(14,2)",
            "description": "#N/A",
            "display": "Deposit",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "ending_bank_balance",
            "type": "numeric(14,2)",
            "description": "",
            "display": "Ending Bank Balance",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "beginning_bank_balance": 14541997.39,
            "partner_funds_loads_net": -2120422.68,
            "deposit": 6282389.53,
            "ending_bank_balance": 18703964.24
        },
        {
            "beginning_bank_balance": 11801746.53,
            "partner_funds_loads_net": -2167366.2,
            "deposit": 7468791.23,
            "ending_bank_balance": 17103171.56
        },

        ...

        {
            "beginning_bank_balance": 18403962.62,
            "partner_funds_loads_net": -2017736.39,
            "deposit": 1126740.66,
            "ending_bank_balance": 17512966.89
        }
    ]
}
```

<h3 id="_monitoring_a_funding_account">
  Monitoring a funding account
</h3>

To monitor a funding account, use the `/programbalances/day` endpoint. The `/programbalances/day` endpoint includes the `beginning_bank_balance` and `ending_bank_balance` fields, which show the change in program funds over the course of a day. The following example shows a request that includes both bank balance fields:

`https://diva-api.marqeta.com/data/v2/views/programbalances/day?program=my_program&fields=beginning_bank_balance,ending_bank_balance`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 16,
    "is_more": false,
    "count": 16,
    "info": {},
    "start_date": "2023-10-01T00:00:00+0000",
    "end_date": "2023-10-02T00:00:00+0000",
    "last_run_time": "2022-08-27T16:08:03Z",
    "schema": [
        {
            "field": "beginning_bank_balance",
            "type": "numeric(14,2)",
            "description": "#N/A",
            "display": "Beginning Bank Balance",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "ending_bank_balance",
            "type": "numeric(14,2)",
            "description": "",
            "display": "Ending Bank Balance",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "beginning_bank_balance": 13253690.06,
            "ending_bank_balance": 13883983.47
        },
        {
            "beginning_bank_balance": 13883983.47,
            "ending_bank_balance": 13721500.57
        },

        ...

        {
            "beginning_bank_balance": 8856705.74,
            "ending_bank_balance": 7106342.25
        }
    ]
}
```

<h3 id="_monitoring_program_performance_and_growth">
  Monitoring program performance and growth
</h3>

Several endpoints are useful for monitoring program performance and growth. Monitoring balances, authorizations, and settlements over time can provide data points for tracking progress.

<h4 id="_authorizations">
  Authorizations
</h4>

The following request to the `/authorizations` endpoint returns the authorization amounts and count for the current month:

`https://diva-api.marqeta.com/data/v2/views/authorizations/month?program=my_program&fields=acting_users,acting_cards,transaction_count,transaction_amount`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 47,
    "is_more": false,
    "count": 47,
    "info": {},
    "start_date": "2023-10-01T00:00:00+0000",
    "end_date": "2023-10-04T00:00:00+0000",
    "last_run_time": "2023-09-04T08:09:22Z",
    "schema": [
        {
            "field": "acting_users",
            "type": "integer",
            "description": "The number of distinct acting user tokens related to a particular grouping of transactions and date. Note that this value is valid only when all available columns are included.",
            "display": "Acting Users",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "acting_cards",
            "type": "integer",
            "description": "The number of distinct acting card tokens related to a particular grouping of transactions and date. Note that this value is valid only when all available columns are included.",
            "display": "Acting Cards",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "transaction_count",
            "type": "integer",
            "description": "#N/A",
            "display": "Transaction Count",
            "units": null,
            "has_total": true,
            "is_filter_only": false
        },
        {
            "field": "transaction_amount",
            "type": "numeric(14,2)",
            "description": "The amount of the transaction or sum total amount of multiple, relevant transactions.",
            "display": "Transaction Amount",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "acting_users": 3,
            "acting_cards": 3,
            "transaction_count": 3,
            "transaction_amount": 0.0
        },
        {
            "acting_users": 2,
            "acting_cards": 2,
            "transaction_count": 2,
            "transaction_amount": 0.0
        },

        ...

        {
            "acting_users": 30,
            "acting_cards": 30,
            "transaction_count": 40,
            "transaction_amount": 2968.38
        }
    ]
}
```

<h4 id="_settlements">
  Settlements
</h4>

For monitoring settlements, use the `/settlements/detail` endpoint. This endpoint includes the `transaction_status` and `purchases` fields, which provide useful settlement information. The following example returns a detailed report that includes these fields:

`https://diva-api.marqeta.com/data/v2/views/settlements/detail?program=my_program&fields=,transaction_status,post_date,purchases`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 15787,
    "is_more": true,
    "count": 10000,
    "info": {},
    "start_date": "2023-05-01T00:00:00+0000",
    "end_date": "2023-05-01T00:00:00+0000",
    "last_run_time": "2023-05-04T16:09:22Z",
    "schema": [
        {
            "field": "transaction_status",
            "type": "character varying(128)",
            "description": "The status of the transaction.",
            "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",
                "Undefined"
            ],
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "post_date",
            "type": "date",
            "description": "The date a transaction was posted by the network.",
            "display": "Post Date",
            "units": null,
            "has_total": false,
            "date_format": "YYYY-MM-DD",
            "is_filter_only": false
        },
        {
            "field": "purchases",
            "type": "numeric(14,2)",
            "description": "The amount of purchases and any reversals related to settled transactions.",
            "display": "Purchases",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "transaction_status": "Clear Settlement",
            "post_date": "2023-03-17T00:00:00.000Z",
            "purchases": -834.49
        },
        {
            "transaction_status": "Clear Settlement",
            "post_date": "2023-03-17T00:00:00.000Z",
            "purchases": -0.23
        },

        ...

        {
            "transaction_status": "Clear Settlement",
            "post_date": "2023-03-17T00:00:00.000Z",
            "purchases": -1421.97
        }
    ]
}
```

<h4 id="_clearings">
  Clearings
</h4>

To monitor clearings, use the `/clearing/detail` endpoint. This endpoint includes the `transaction_status`, `transaction_processing_type`, and `sig_purchases` fields, which provide useful clearings information. The `/clearing/detail` endpoint provides accounting-level line items that correspond to stages of the transaction lifecycle, making it ideal for reconciliation. The following example returns a detailed report that includes these fields:

`https://diva-api.marqeta.com/data/v2/views/clearing/detail?program=my_program&fields=transaction_status,post_date,sig_purchases`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 14789,
    "is_more": true,
    "count": 10000,
    "info": {},
    "start_date": "2023-05-01T00:00:00+0000",
    "end_date": "2023-05-02T00:00:00+0000",
    "last_run_time": "2023-05-04T16:09:22Z",
    "schema": [
        {
            "field": "transaction_status",
            "type": "character varying(128)",
            "description": "The status of the transaction.",
            "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",
                "Undefined"
            ],
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "post_date",
            "type": "date",
            "description": "The date a transaction was posted by the network.",
            "display": "Post Date",
            "units": null,
            "has_total": false,
            "date_format": "YYYY-MM-DD",
            "is_filter_only": false
        },
        {
            "field": "sig_purchases",
            "type": "numeric(14,2)",
            "description": "The amount of signature based purchase transactions, defined by transactions having funds flow through a Mastercard, Visanet, or Discover account.",
            "display": "Sig Purchases",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "transaction_status": "Clear Settlement",
            "post_date": "2023-03-17T00:00:00.000Z",
            "sig_purchases": -733.48
        },
        {
            "transaction_status": "Clear Settlement",
            "post_date": "2023-03-18T00:00:00.000Z",
            "sig_purchases": -70.23
        },

        ...

        {
            "transaction_status": "Clear Settlement",
            "post_date": "2023-03-18T00:10:00.000Z",
            "sig_purchases": -2322.67
        }
    ]
}
```

<h3 id="_monitoring_declined_transactions">
  Monitoring declined transactions
</h3>

To monitor declined transactions, use the `/declines` endpoint with the Detail, Daily, Weekly, or Monthly aggregation level. The `/declines` endpoint includes `transaction_token`, `displaymessage`, `merchant`, and `transaction_amount` fields, which provide information on declines. The following example returns a detailed report that includes these fields:

`https://diva-api.marqeta.com/data/v2/views/declines/detail?my_program&fields=transaction_token,displaymessage,merchant,transaction_amount`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 2686,
    "is_more": false,
    "count": 2686,
    "info": {},
    "start_date": "2023-10-01T00:00:00+0000",
    "end_date": "2023-10-03T00:00:00+0000",
    "last_run_time": "",
    "schema": [
        {
            "field": "transaction_token",
            "type": "character varying(128)",
            "description": "The token of the transaction; unique within a program.",
            "display": "Transaction Token",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "displaymessage",
            "type": "character varying(279)",
            "description": "A user-friendly message describing the outcome of a transaction.",
            "display": "Displaymessage",
            "enum_values": [
                "Auth restriction found for given mid or mcc",
                "Card not active",
                "Card suspicious - Expiration mismatch",
                "Cardholder not active",
                "Invalid Pin",
                "Invalid card security code",
                "Network decline advice",
                "Not sufficient funds",
                "Security violation",
                "Transactions not allowed from this country"
            ],
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "merchant",
            "type": "character varying(765)",
            "description": "The merchant associated with the transaction; where a transaction took place.",
            "display": "Merchant",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "transaction_amount",
            "type": "numeric(14,2)",
            "description": "The amount of the transaction or sum total amount of multiple, relevant transactions.",
            "display": "Transaction Amount",
            "units": "USD",
            "has_total": true,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "transaction_token": 19687088,
            "displaymessage": "Not sufficient funds",
            "merchant": "TARGET.COM",
            "transaction_amount": 15.39
        },
        {
            "transaction_token": 19687521,
            "displaymessage": "Transactions not allowed from this country",
            "merchant": "DHgate",
            "transaction_amount": 69.72
        },

        ...

        {
            "transaction_token": 19688470,
            "displaymessage": "Not sufficient funds",
            "merchant": "AMZN DIGITAL 888-802-3",
            "transaction_amount": 14.99
        }
     ]
}
```

<h3 id="_viewing_chargeback_details_or_status">
  Viewing chargeback details or status
</h3>

To request the details of submitted chargebacks, use the `/chargebacks` endpoint. You can generate a status report using the `/chargebacks/status` endpoint, or chargeback details using `/chargebacks/detail`.

<h4 id="_chargeback_status">
  Chargeback status
</h4>

To see the status of current chargebacks, use the `/chargebacks/status` endpoint. Useful fields include `chargeback_token`, `chargeback_state`, and `provisional_credit_given`. This example requests those fields for chargebacks on the Mastercard network:

`https://diva-api.marqeta.com/data/v2/views/chargebacks/status?program=my_program&network=MASTERCARD&fields=chargeback_token,chargeback_state,provisional_credit_given`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 326,
    "is_more": false,
    "count": 326,
    "info": {},
    "start_date": "2023-10-01T00:00:00+0000",
    "end_date": "2023-10-03T00:00:00+0000",
    "last_run_time": "2023-10-02T16:10:35Z",
    "schema": [
        {
            "field": "chargeback_token",
            "type": "bigint",
            "description": "unique token to identify a chargeback record within a program.",
            "display": "Chargeback Token",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "chargeback_state",
            "type": "character varying(50)",
            "description": "The current state of the chargeback.",
            "display": "Chargeback State",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "provisional_credit_given",
            "type": "character(1)",
            "description": "Signifies whether a provisional credit has been granted to a cardholder in relation to a chargeback submission. A \"Y\" will be present if a provisional credit has been given and a \"N\" if a provisional credit has not been given.",
            "display": "Provisional Credit Given",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "chargeback_token": 693,
            "chargeback_state": "CASE_WON",
            "provisional_credit_given": "N"
        },
        {
            "chargeback_token": 754,
            "chargeback_state": "CASE_LOST",
            "provisional_credit_given": "N"
        },

        ...

        {
            "chargeback_token": 811,
            "chargeback_state": "CASE_WON",
            "provisional_credit_given": "N"
        }
    ]
}
```

<h4 id="_chargeback_detail">
  Chargeback detail
</h4>

To see the details of current chargebacks, use the `/chargebacks/detail` endpoint. This example requests the `chargeback_token`, `chargeback_state`, `transaction_date`, and `transaction_type` fields for current chargebacks:

`https://diva-api.marqeta.com/data/v2/views/chargebacks/detail?program=my_program&fields=chargeback_token,chargeback_state,transaction_date,transaction_type`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 738,
    "is_more": false,
    "count": 738,
    "info": {},
    "start_date": "2023-10-01T00:00:00+0000",
    "end_date": "2023-10-03T00:00:00+0000",
    "last_run_time": "2023-10-02T16:10:35Z",
    "schema": [
        {
            "field": "chargeback_token",
            "type": "bigint",
            "description": "unique token to identify a chargeback record within a program.",
            "display": "Chargeback Token",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "chargeback_state",
            "type": "character varying(30)",
            "description": "The current state of the chargeback.",
            "display": "Chargeback State",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "transaction_date",
            "type": "timestamp without time zone",
            "description": "The number of transactions related to a particular grouping of transactions and date.",
            "display": "Transaction Date",
            "units": null,
            "has_total": false,
            "date_format": "YYYY-MM-DD HH:mm:ss",
            "is_filter_only": false
        },
        {
            "field": "transaction_type",
            "type": "character varying(256)",
            "description": "A type field that categorizes the transaction event.",
            "display": "Transaction Type",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "chargeback_token": 629,
            "chargeback_state": "CASE_WON",
            "transaction_date": "2019-06-11T00:00:00.000Z",
            "transaction_type": "authorization.clearing.chargeback.completed"
        },
        {
            "chargeback_token": 734,
            "chargeback_state": "INITIATED",
            "transaction_date": "2019-06-21T00:00:00.000Z",
            "transaction_type": "authorization.clearing.chargeback"
        },

        ...

        {
            "chargeback_token": 741,
            "chargeback_state": "INITIATED",
            "transaction_date": "2019-06-27T00:00:00.000Z",
            "transaction_type": "authorization.clearing.chargeback"
        }
    ]
}
```

<h3 id="_reviewing_card_and_user_demographics">
  Reviewing card and user demographics
</h3>

The DiVA API provides endpoints for getting information on card and user demographics.

<h4 id="_cards">
  Cards
</h4>

To get detailed card information, use the `/cards/detail` endpoint. Fields of interest include `user_token`, `uai`, `card_state`, and `active_card`. The following example requests those fields:

`https://diva-api.marqeta.com/data/v2/views/cards/detail?program=my_program&fields=user_token,uai,card_state,active_card`

This request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 2985649,
    "is_more": true,
    "count": 10000,
    "info": {},
    "start_date": null,
    "end_date": null,
    "last_run_time": "2023-10-03T01:10:08Z",
    "schema": [
        {
            "field": "user_token",
            "type": "character varying(128)",
            "description": "A unique identifier (within a given Marqeta Card Program) for a user record. All other references to a user token will be prefaced with account, business, parent or acting to specify which user token is referenced.",
            "display": "User Token",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "uai",
            "type": "character varying(128)",
            "description": "The unique account identifier (UAI) for a user; unique across programs.",
            "display": "Uai",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "card_state",
            "type": "character varying(128)",
            "description": "The current state of the card: unactivated, active, suspended, or terminated.",
            "display": "Card State",
            "enum_values": [],
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "active_card",
            "type": "integer",
            "description": "Indicates whether a card is currently active, marked with a 1 or 0 if not currently active.",
            "display": "Active Card",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "user_token": "000KDYKYJZ3WKDRW",
            "uai": "40011224706717054",
            "card_state": "Terminated",
            "active_card": null
        },
        {
            "user_token": "001C0HUNKL7K548E",
            "uai": "40011223020630662",
            "card_state": "Active",
            "active_card": 1
        },

        ...

        {
            "user_token": "0020PWTRJ4BMKRAT",
            "uai": "40011229517786768",
            "card_state": "Terminated",
            "active_card": null
        }
    ]
}
```

<h4 id="_users">
  Users
</h4>

To retrieve detailed user information, use the `/users/detail` endpoint. Useful fields include `user_token`, `uai`, `number_of_physical_cards`, and `number_of_virtual_cards`. This example retrieves those fields:

`https://diva-api.marqeta.com/data/v2/views/users/detail?program=my_program&fields=user_token,uai,number_of_physical_cards,number_of_virtual_cards`

The request generates a response similar to the following:

```json JSON expandable lines wrap theme={null}
{
    "total": 2994890,
    "is_more": true,
    "count": 10000,
    "info": {},
    "start_date": null,
    "end_date": null,
    "last_run_time": "2023-10-03T14:10:18Z",
    "schema": [
        {
            "field": "user_token",
            "type": "character varying(128)",
            "description": "A unique identifier (within a given Marqeta Card Program) for a user record. All other references to a user token will be prefaced with account, business, parent or acting to specify which user token is referenced.",
            "display": "User Token",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "uai",
            "type": "character varying(128)",
            "description": "The unique account identifier (UAI) for a user; unique across programs.",
            "display": "Uai",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "number_of_physical_cards",
            "type": "integer",
            "description": "The number of physical cards (regardless of state) attached to a cardholder account.",
            "display": "Number Of Physical Cards",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        },
        {
            "field": "number_of_virtual_cards",
            "type": "integer",
            "description": "The number of virtual cards (regardless of state) attached to a cardholder account.",
            "display": "Number Of Virtual Cards",
            "units": null,
            "has_total": false,
            "is_filter_only": false
        }
    ],
    "records": [
        {
            "user_token": "000Q5QPNY4OIVZ0O",
            "uai": "00001229347437224",
            "number_of_physical_cards": 0,
            "number_of_virtual_cards": 1
        },
        {
            "user_token": "001UW90B9UNZLXVF",
            "uai": "00001227753099702",
            "number_of_physical_cards": 0,
            "number_of_virtual_cards": 1
        },

        ...

        {
            "user_token": "002CPJ28FXLYMDZS",
            "uai": "00001226643565161",
            "number_of_physical_cards": 0,
            "number_of_virtual_cards": 1
        }
    ]
}
```


## Related topics

- [Introduction to the DiVA API](/docs/diva-api/introduction.md)
- [Authentication with the DiVA API](/docs/diva-api/authentication.md)
- [Errors DiVA API](/docs/diva-api/errors.md)
- [DiVA API Card Views](/docs/diva-api/cards.md)
- [Reporting Overview](/docs/developer-guides/reporting-landing-page.md)
