Skip to main content

Batch Account Updater
Enterprise

Account Updater is an Enterprise feature. Request access in the portal.

Create Account Updater Batch Job

Creates an Account Updater Batch Job to update a batch of card tokens. Responds with an Account Updater Job including an upload_url to submit a request CSV file for processing.

POST
https://api.basistheory.com/account-updater/jobs
Copy

Permissions

account-updater:job:create

Expiration

You have one hour to upload a request file, at which time the job and upload url will expire and the job will be removed. Attempting to retrieve an expired job will result in a 404 status code. If a job expires, simply start the process again by creating a new job.

Request

curl "https://api.basistheory.com/account-updater/jobs" \
-X POST \
-H 'Content-Type: application/json' \
-H 'BT-API-KEY: ...' \
-d '{
"result_version": "1.2"
}'

Request Parameters

AttributeRequiredTypeDefaultDescription
deduplicate_tokensfalsebooleanWhether to deduplicate tokens when performing updates
configuration_merchant_idfalseuuidThe tenant merchant whose Account Updater configuration is used for this job. Does not affect which tokens the job can read. See Merchant Scoping and Configuration.
merchant_idfalseuuidDeprecated: use configuration_merchant_id instead. Legacy alias kept for backward compatibility with lower precedence.
result_versionfalsestring1Version of the result CSV format. Accepted values are 1, 1.1, and 1.2.

The deduplicate_tokens parameter will override the tenant-level deduplicate tokens setting. If token deduplication is enabled and an account update is received with data matching an existing token's fingerprint, the existing token will be updated and returned instead of creating a new token.

The result_version parameter controls which columns are included in the result file. See Result Versions for details on the differences between versions.

Merchant Scoping and Configuration

Merchants affect a job in two independent ways:

  • Token scope is set by the optional BT-MERCHANT-ID request header. Tokens in the request file are read within that merchant's scope, and updated tokens are created under the same merchant. Without the header, the job runs at the tenant level.
  • Account Updater configuration is selected by the optional configuration_merchant_id parameter, which determines the merchant configuration (the merchant details registered with the card networks during onboarding) used to request updates. When omitted, it defaults to the configuration of the BT-MERCHANT-ID header merchant, then to the tenant-level configuration.
Use CaseHow to Configure
Tenant-level tokens using the tenant's configurationOmit the BT-MERCHANT-ID header and configuration_merchant_id.
Tenant-level tokens using a merchant's configurationOmit the BT-MERCHANT-ID header and set configuration_merchant_id. This is the most common pattern for tenants onboarded with multiple merchant configurations whose tokens are not merchant-scoped.
A merchant's tokens using that merchant's configurationSend the BT-MERCHANT-ID header. The header merchant's configuration is used by default.
A merchant's tokens using a different merchant's configurationSend the BT-MERCHANT-ID header and set configuration_merchant_id.

If the selected merchant does not have its own Account Updater configuration, the tenant-level configuration is used.

Response

Returns the created Account Updater Job.

{
"id": "93f3da5e-7887-408c-88ed-b10a5fdb423a",
"tenant_id": "9a63ab82-1d11-59a0-93ab-4e1ec98b9fdd",
"status": "pending",
"created_by": "2c8f4156-4ac6-5e71-9e03-8811fd6bc514",
"created_at": "2024-04-09T13:56:37.864Z",
"expires_at": "2024-04-09T14:56:37.864Z",
"upload_url": "https://bt-prod-us-east-2-account-updater-data.s3.us-east-2.amazonaws.com/...",
"errors": null,
"requests": null,
"results": null
}

Get Account Updater Job

Retrieves an Account Updater Job. This endpoint can be used to poll for job failure or completion if webhook callbacks are not desired.

GET
https://api.basistheory.com/account-updater/jobs/{id}
Copy

Permissions

account-updater:job:read

Request

curl "https://api.basistheory.com/account-updater/jobs/93f3da5e-7887-408c-88ed-b10a5fdb423a" \
-H 'BT-API-KEY: ...'

Response

{
"id": "93f3da5e-7887-408c-88ed-b10a5fdb423a",
"tenant_id": "9a63ab82-1d11-59a0-93ab-4e1ec98b9fdd",
"status": "completed",
"created_by": "2c8f4156-4ac6-5e71-9e03-8811fd6bc514",
"created_at": "2024-04-09T13:56:37.864Z",
"download_url": "https://bt-prod-us-east-2-account-updater-data.s3.us-east-2.amazonaws.com/...",
"errors": null,
"requests": 1000,
"results": {
"UPD_PAN": 45,
"NO_UPDATE": 856,
"WRN_CLOSED_ACCOUNT": 8
}
}

List Account Updater Jobs

Return a list of all Account Updater Jobs created for the tenant.

GET
https://api.basistheory.com/account-updater/jobs
Copy

Permissions

account-updater:job:read

Request

curl "https://api.basistheory.com/account-updater/jobs" \
-H 'BT-API-KEY: ...'

Sort Order

This endpoint returns newest jobs first.

Query Params

ParamDescription
sizeThe maximum number of jobs to return in the response. Defaults to 20.
startThe cursor at which the result set should start. This is the value of the next cursor returned in the previous response.

Response

Returns a cursor paginated list of Account Updater Jobs.

{
"pagination": {
"next": "Q1JFQVRFRF9BVCMyMDI0LTA0LTI1VDE2OjU4OjA3LjgyMVo=",
"page_size": 20
},
"data": [
{
"id": "93f3da5e-7887-408c-88ed-b10a5fdb423a",
"tenant_id": "9a63ab82-1d11-59a0-93ab-4e1ec98b9fdd",
"status": "completed",
"created_by": "2c8f4156-4ac6-5e71-9e03-8811fd6bc514",
"created_at": "2024-04-09T13:56:37.864Z",
"download_url": "https://bt-prod-us-east-2-account-updater-data.s3.us-east-2.amazonaws.com/...",
"errors": null,
"requests": 1000,
"results": {
"UPD_PAN": 45,
"NO_UPDATE": 856,
"WRN_CLOSED_ACCOUNT": 8
}
},
...
]
}

File Format Specifications

Request File Format

Account Updater request CSV files must use the following format:

PropertyDefinitionRequired
tokenA card token to be updated. The expiration date in this token is optional, and if present, will be sent to the networks when requesting updates.true
expiration_year(Optional) The 4-digit expiration year of the account number. This is not required if the card token has expiration_year stored.false
expiration_month(Optional) The 2-digit expiration month of the account number. This is not required if the card token has expiration_month stored.false
merchant_id(Ignored) Any values in this column are ignored. Merchant scoping is controlled by the BT-MERCHANT-ID request header instead; leave this column empty.false

To scope a job's tokens to a specific merchant, send the BT-MERCHANT-ID request header when creating the job; see Merchant Scoping and Configuration. Tokens in the file are then read within that merchant's scope, and rows referencing tokens outside it fail with ERR_MERCHANT_MISMATCH. The values of the legacy merchant_id column are ignored.

Example

token,expiration_year,expiration_month,merchant_id
d2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,
f32bc1b4-5c3a-45a3-9ee2-392a1c475d53,2030,02,

Result File Format

We do not consider the addition of columns to this file a breaking change.

The result file is used to communicate any tokens created as a result of an updated account number or expiration date. This file only includes rows that resulted in a successful update, a warning, or an error (see Result Codes for details). Rows that did not result in any updates (i.e. the NO_UPDATE result code), warnings, or errors are omitted from the result file.

Account Updater result CSV files will use the following format:

PropertyDefinitionAlways Returned
tokenThe card token to be updated, as sent in the request filetrue
expiration_yearThe expiration year that was originally sent.false
expiration_monthThe expiration_month that was sent in the request file.false
new_tokenThe new card token created with updated card details. Update any references to this token in your systems.false (only on successful update)
new_expiration_yearThe new expiration year returned from the update.false
new_expiration_monthThe new expiration month returned from the update.false
result_codeCode summarizing the processing status of the row. See Result Codes below for details.true
new_fingerprintThe fingerprint of the new card token. Only included when result_version is 1.1 or higher.false (only in version 1.1 or higher)
new_brandThe card brand of the new card token (e.g. visa, mastercard). Only included when result_version is 1.1 or higher.false (only in version 1.1 or higher)
new_last4The last 4 digits of the new card token's card number. Only included when result_version is 1.2 or higher.false (only in version 1.2 or higher)

Result Versions

The result_version parameter on the Create Job request controls which columns are included in the result CSV.

VersionDescription
1Default. Returns the base columns: token, expiration_year, expiration_month, new_token, new_expiration_year, new_expiration_month, and result_code.
1.1Adds new_fingerprint and new_brand columns after result_code. These columns contain the fingerprint and card brand of the newly created token, allowing you to identify updated cards without making a separate API call to retrieve the token.
1.2Adds a new_last4 column after new_brand, containing the last 4 digits of the newly created token's card number. Includes all columns from version 1.1.

Example (version 1)

token,expiration_year,expiration_month,new_token,new_expiration_year,new_expiration_month,result_code
d2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,b2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,UPD_PAN
f32bc1b4-5c3a-45a3-9ee2-392a1c475d53,2030,02,,,,WRN_CLOSED_ACCOUNT

Example (version 1.1)

token,expiration_year,expiration_month,new_token,new_expiration_year,new_expiration_month,result_code,new_fingerprint,new_brand
d2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,b2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,UPD_PAN,4DdMqM2rHjk3HPq9A3mVRnLFfkz8JMbRVmG93jFp87K2,visa
f32bc1b4-5c3a-45a3-9ee2-392a1c475d53,2030,02,,,,WRN_CLOSED_ACCOUNT,,

Example (version 1.2)

token,expiration_year,expiration_month,new_token,new_expiration_year,new_expiration_month,result_code,new_fingerprint,new_brand,new_last4
d2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,b2cbc1b4-5c3a-45a3-9ee2-392a1c475ab4,,,UPD_PAN,4DdMqM2rHjk3HPq9A3mVRnLFfkz8JMbRVmG93jFp87K2,visa,4242
f32bc1b4-5c3a-45a3-9ee2-392a1c475d53,2030,02,,,,WRN_CLOSED_ACCOUNT,,,

Resources

Account Updater Job

PropertyTypeDescription
idstringIdentifier for the account updater job
tenant_iduuidThe tenant this job is associated with
statusstringThe job status
expires_atdatetimeTime the upload URL will expire. This property is only returned while the job is in the pending status.
created_byuuidThe id of the application used to create the job
created_atdatetimeTimestamp when this job was created
upload_urlstringThe URL to which the Request File should be uploaded. This will only be returned when the job is in the pending status.
errorsarray<string>An array of error messages encountered when attempting to process the job
requestsintegerTotal number of records in the request file. Populated after processing completes.
resultsobjectCount of each result code across all processed rows (e.g. {"UPD_PAN": 45, "NO_UPDATE": 856}). Populated after processing completes.
download_urlstringThe URL to download the Result File. This will only be returned when the job is in the completed status.

Job Statuses

StatusDescription
pendingThe job has been created and is waiting for the request file to be uploaded.
processingThe job is currently being processed.
completedThe job has been processed and the result file is available for download.
failedThe job failed to process, and the result file is not available. Errors will be included in the job's errors property.