Card Counts

Retrieve card count data, such as the number of cards in circulation or how many are active or suspended, at a specified aggregation level. 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, and pagination. For more information about response options, see Response Customization.

Retrieve card count data (JSON)

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

Retrieve card 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. day | week | month

Sample response body

The following sample shows a representative response for a GET request to the /views/cardcounts/day?program=my_program&fields=card_type,in_suspension_eop,in_suspension_ever_during endpoint.

{
"total": 32,
"is_more": false,
"count": 32,
"info": {},
"start_date": "2019-02-01T00:00:00+0000",
"end_date": "2019-02-14T00:00:00+0000",
"last_run_time": "2019-02-07T00:02:00Z",
"schema": [
{
"field": "card_type",
"type": "character varying(128)",
"description": "The type of card: virtual, physical.",
"display": "Card Type",
"enum_values": [],
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "in_suspension_eop",
"type": "bigint",
"description": null,
"display": "In Suspension Eop",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "in_suspension_ever_during",
"type": "bigint",
"description": null,
"display": "In Suspension Ever During",
"units": null,
"has_total": false,
"is_filter_only": false
}
],
"records": [
{
"card_type": "VIRTUAL_PAN",
"in_suspension_eop": 7,
"in_suspension_ever_during": 7
},
{
"card_type": "PHYSICAL_MSR",
"in_suspension_eop": 0,
"in_suspension_ever_during": 0
},
...
{
"card_type": "VIRTUAL_PAN",
"in_suspension_eop": 7,
"in_suspension_ever_during": 7
}
]
}


Retrieve card count data (file export)

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

Retrieve card count 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. day | week | month
export_type string Yes File format in which to export the data. csv

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 card count schema

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

Retrieve a JSON representation of the cardcounts 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. day | week | month

Sample response body

The following sample shows a representative response for a GET request to the /views/cardcounts/day/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)",
"description": "The name of the card program.",
"display": "Program",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "period_start_date",
"type": "date",
"description": null,
"display": "Period Start Date",
"units": null,
"has_total": false,
"date_format": "YYYY-MM-DD",
"is_filter_only": false
},
{
"field": "card_type",
"type": "character varying(128)",
"description": "The type of card: virtual, physical.",
"display": "Card Type",
"enum_values": [],
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "circulating_eop",
"type": "bigint",
"description": null,
"display": "Circulating Eop",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "active_eop",
"type": "bigint",
"description": null,
"display": "Active Eop",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "in_suspension_eop",
"type": "bigint",
"description": null,
"display": "In Suspension Eop",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "circulating_ever_during",
"type": "bigint",
"description": null,
"display": "Circulating Ever During",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "active_ever_during",
"type": "bigint",
"description": null,
"display": "Active Ever During",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "in_suspension_ever_during",
"type": "bigint",
"description": null,
"display": "In Suspension Ever During",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "issued_during_period",
"type": "bigint",
"description": null,
"display": "Issued During Period",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "activated_during_period",
"type": "bigint",
"description": null,
"display": "Activated During Period",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "suspended_during_period",
"type": "bigint",
"description": null,
"display": "Suspended During Period",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "terminated_during_period",
"type": "bigint",
"description": null,
"display": "Terminated During Period",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "swiped_during_period",
"type": "bigint",
"description": null,
"display": "Swiped During Period",
"units": null,
"has_total": false,
"is_filter_only": false
},
{
"field": "entry_createdate",
"type": "timestamp without time zone",
"description": "The date and time when a record has been read into the database following a replication cycle.",
"display": "Entry Createdate",
"units": null,
"has_total": false,
"date_format": "YYYY-MM-DD",
"is_filter_only": false
},
{
"field": "last_modified_time",
"type": "timestamp without time zone",
"description": "The date when the record was most recently updated.",
"display": "Last Modified Time",
"units": null,
"has_total": false,
"date_format": "YYYY-MM-DD",
"is_filter_only": false
},
{
"field": "etl_batch_id",
"type": "bigint",
"description": null,
"display": "Etl Batch Id",
"units": null,
"has_total": false,
"is_filter_only": false
}
]