Credit Account APIs
Create Credit Account
Creates a credit account for a Customer. An account.created event is raised when the call was successful.
Each credit account is created using specific credit terms.
Credit Account creation request supports Idempotency, ensuring that performing multiple identical requests will have the same effect as performing a single request.
| Verb | POST |
| URL | https://api.s.unit.sh/accounts |
| Required Scope | accounts-write |
| Data Type | creditAccount |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| creditTerms | string | The credit terms that will be associated with the account. |
| creditLimit | Integer (Cents) | The credit limit of the account. |
| tags Optional | object | Optional. See Tags. |
| idempotencyKey Optional | string | Optional. See Idempotency. |
Relationships
| Name | Type | Description |
|---|---|---|
| customer | Required for individual / business accounts. JSON:API Relationship | The customer the credit account belongs to. The customer is either a business or an individual. |
curl -X POST 'https://api.s.unit.sh/accounts'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "creditAccount",
"attributes": {
"creditTerms": "credit_terms_1",
"creditLimit": 20000,
"tags": {
"purpose": "some_purpose"
},
"idempotencyKey": "3a1a33be-4e12-4603-9ed0-820922389fb8"
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "45555"
}
}
}
}
}'
Response
Response is a JSON:API document.
201 Created
| Name | Type | Description |
|---|---|---|
| data | CreditAccount | The requested resource after the operation was completed. |
{
"data": {
"type": "creditAccount",
"id": "42",
"attributes": {
"createdAt": "2000-05-11T10:19:30.409Z",
"name": "Peter Parker",
"status": "Open",
"creditTerms": "credit_terms_1",
"currency": "USD",
"balance": 10000,
"hold": 0,
"available": 10000,
"tags": {
"purpose": "some_purpose"
},
"creditLimit": 200000
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "45555"
}
},
"org": {
"data": {
"type": "org",
"id": "1"
}
}
}
}
}
Close Account
Closes an account. Closing an account is irreversible and can only be done by an Org user. An account.closed event is raised when the call was successful.
Closing an account will also close the cards associated with the account. Closed accounts cannot accept repayments
| Verb | POST |
| URL | https://api.s.unit.sh/accounts/:accountId/close |
| Required Scope | accounts-write |
| Data Type | creditAccountClose |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| reason | string | The reason for closing the account. Either ByCustomer, Fraud or Overdue. If not specified, will default to ByCustomer. |
| fraudReason Optional | string | Optional. The expanded fraud reason for closing the account when Fraud is specified as the reason. Can be one of: (ACHActivity, CardActivity, CheckActivity, ApplicationHistory, AccountActivity, ClientIdentified, IdentityTheft, LinkedToFraudulentCustomer). |
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | CreditAccount | Credit Account resource. |
curl -X POST 'https://api.s.unit.sh/accounts/10000/close'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "creditAccountClose",
"attributes": {
"reason": "Overdue"
}
}
}'
Freeze Account
Freezes an account. An account.frozen event is raised when the call was successful. A frozen account behaves like a closed account, with the primary difference being that a frozen state should be temporary, and after evaluation should either be un-frozen, or closed.
Freezing an account will also freeze the cards associated with the account.
| Verb | POST |
| URL | https://api.s.unit.sh/accounts/:accountId/freeze |
| Required Scope | accounts-write |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| reason | string | The reason for closing the account. Either Fraud or Other, with a specified reasonText. |
| reasonText Optional | string | Optional. The free-text reason for freezing the account (up to 255 characters) when Other is specified. |
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | CreditAccount | Credit Account resource. |
curl -X POST 'https://api.s.unit.sh/accounts/10000/freeze'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "creditAccountFreeze",
"attributes": {
"reason": "Other",
"reasonText": "Per request from customer"
}
}
}'
Unfreeze Account
Unfreezes an account.
Unfreezing an account will also unfreeze the cards associated with the account.
| Verb | POST |
| URL | https://api.s.unit.sh/accounts/:accountId/unfreeze |
| Required Scope | accounts-write |
| Timeout (Seconds) | 5 |
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | CreditAccount | Credit Account resource. |
curl -X POST 'https://api.s.unit.sh/accounts/10000/unfreeze'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
Get by Id
Get a credit account resource by id.
| Verb | GET |
| URL | https://api.s.unit.sh/accounts/{id} |
| Required Scope | accounts |
| Timeout (Seconds) | 5 |
Query Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| include | string | (empty) | Optional. Related resource available to include: customer. See Getting Related Resources |
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | CreditAccount | Credit Account resource. |
| included | Array of Customer | Array of resources requested by the include query parameter. |
curl -X GET 'https://api.s.unit.sh/accounts/42' \
-H "Authorization: Bearer ${TOKEN}"
List
Listing credit accounts is similar to listing deposit accounts, with a specific account type filter (see below)
| Verb | GET |
| URL | https://api.s.unit.sh/accounts |
| Required Scope | accounts |
| Timeout (Seconds) | 5 |
Query Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| page[limit] | integer | 100 | Optional. Maximum number of resources that will be returned. Maximum is 1000 resources. See Pagination. |
| page[offset] | integer | 0 | Optional. Number of resources to skip. See Pagination. |
| filter[customerId] | string | (empty) | Optional. Filters the results by the specified customer id. |
| filter[tags] | Tags (JSON) | (empty) | Optional. Filter Accounts by Tags. |
| filter[status] | string | Authorized | Optional. Filter Account by its status (Open, Frozen, or Closed). Usage example: filter[status][0]=Closed |
| filter[fromBalance] | Integer | (empty) | Optional. Filters Accounts that have balance higher or equal to the specified amount (in cents). e.g. 5000 |
| filter[toBalance] | Integer | (empty) | Optional. Filters Accounts that have balance lower or equal to the specified amount (in cents). e.g. 7000 |
| filter[type] | string | (empty) | Optional. Filters Accounts by type. Valid values are deposit or credit. |
| include | string | (empty) | Optional. Related resource available to include: customer. See Getting Related Resources |
curl -X GET 'https://api.s.unit.sh/accounts?page[limit]=20&page[offset]=10&filter[type]=credit' \
-H "Authorization: Bearer ${TOKEN}"
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | Array of DepositAccount or CreditAccount | Array of account resources. |
| included | Array of Customer | Array of resources requested by the include query parameter. |
{
"data": [
{
"type": "depositAccount",
"id": "42",
"attributes": {
"createdAt": "2000-05-11T10:19:30.409Z",
"name": "Peter Parker",
"status": "Open",
"depositProduct": "checking",
"routingNumber": "812345678",
"accountNumber": "1000000002",
"currency": "USD",
"balance": 10000,
"hold": 0,
"available": 10000,
"tags": {
"purpose": "tax"
}
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "45555"
}
}
}
}
]
}
Update
Update a credit account.
| Verb | PATCH |
| URL | https://api.s.unit.sh/accounts/:accountId |
| Data Type | creditAccount |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| tags Optional | object | Optional. See Updating Tags. |
| creditLimit Optional | Integer (Cents) | Optional. The credit limit of the account. |
curl -X PATCH 'https://api.s.unit.sh/accounts/42'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "creditAccount",
"attributes": {
"tags": {
"newTag": "New tag value"
}
}
}
}'
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | CreditAccount | Credit Account resource. |
{
"data": {
"type": "creditAccount",
"id": "42",
"attributes": {
"createdAt": "2000-05-11T10:19:30.409Z",
"name": "Peter Parker",
"status": "Open",
"creditTerms": "credit_terms_1",
"currency": "USD",
"balance": 10000,
"hold": 0,
"available": 10000,
"tags": {
"purpose": "Tax",
"newTag": "New tag value"
},
"creditLimit": 200000
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "45555"
}
}
}
}
}
Limits
| Verb | GET |
| URL | https://api.s.unit.sh/accounts/:accountId/limits |
| Timeout (Seconds) | 5 |
curl -X GET 'https://api.s.unit.sh/accounts/10104/limits' \
-H "Authorization: Bearer ${TOKEN}"
Some monetary transactions (such as originating ACH payments) are subject to daily and/or monthly amount limits that are defined on the account level. You can read more about the account limits on our limits guide. Note that credit accounts do not support withdrawals.
The response to this API call includes the defined limits, as well as the current total amounts on each transaction type (under the totalsDaily and totalsMonthly fields), in cents.
The daily limits reset at 12:00 a.m. on the timezone of relevant bank. The monthly limits are reset at the same time on the first of each month.
{
"data": {
"type": "creditLimits",
"id": "10014",
"attributes": {
"card": {
"limits": {
"dailyWithdrawal": 0,
"dailyDeposit": 0,
"dailyPurchase": 500000,
"dailyCardTransaction": 0
},
"totalsDaily": {
"withdrawals": 0,
"deposits": 0,
"purchases": 12500,
"cardTransactions": 0
}
}
}
}
}
Get Account Balance History
List account end-of-day balances history (filtering and paging can be applied).
The account balance history can be used to provide the customer with an overview of their balance across account(s) over time in a visually engaging way, providing insights and creating custom product features around it.
The typical cutoff time (end-of-day) is 7PM, but may vary between banks. The exact time and timezone are determined by the partner bank you work with.
| Verb | GET |
| URL | https://api.s.unit.sh/account-end-of-day |
| Required Scope | account-end-of-day |
| Timeout (Seconds) | 5 |
Query Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| page[limit] | integer | 100 | Optional. Maximum number of resources that will be returned. Maximum is 1000 resources. |
| page[offset] | integer | 0 | Optional. Number of resources to skip. |
| filter[accountId] | string | (empty) | Optional. Filters the results by the specified account id. |
| filter[customerId] | string | (empty) | Optional. Filters the results by the specified customer id. |
| filter[since] | ISO Local Date string | (empty) | Optional. Filters the account end-of-day balances after the specified date. e.g. 2021-06-01 |
| filter[until] | ISO Local Date string | (empty) | Optional. Filters the account end-of-day balances before the specified date. e.g. 2021-07-01 |
curl -X GET 'https://api.s.unit.sh/account-end-of-day?page[limit]=10&page[offset]=0&filter[customerId]=10000&filter[accountId]=30317&filter[since]=2020-10-11&filter[until]=2021-10-13' \
-H "Authorization: Bearer ${TOKEN}"
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | Array of Account End-Of-Day | Array of account end-of-day resources. |
| meta | JSON object that contains pagination data | Pagination data includes offset, limit and total (estimated total items). |
{
"data": [
{
"type": "accountEndOfDay",
"id": "4925158",
"attributes": {
"date": "2021-07-10",
"balance": 1000,
"available": 500,
"hold": 500
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "30317"
}
}
}
},
{
"type": "accountEndOfDay",
"id": "4925158",
"attributes": {
"date": "2021-07-11",
"balance": 1000,
"available": 500,
"hold": 500
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "30317"
}
}
}
}
],
"meta": {
"pagination": {
"total": 12,
"limit": 2,
"offset": 0
}
}
}
Repayment Information
| Verb | GET |
| URL | https://api.s.unit.sh/accounts/:accountId/repayment-information |
| Timeout (Seconds) | 5 |
curl -X GET 'https://api.s.unit.sh/accounts/10104/repayment-information' \
-H "Authorization: Bearer ${TOKEN}"
The response to this API call includes the current repayment information, in cents.
{
"data": {
"type": "creditAccountRepaymentInformation",
"attributes": {
"remainingAmountDue": 10000,
"remainingAmountOverdue": 2000,
"initiatedRepayments": 100,
"statementPeriodStart": "2023-07-01",
"statementPeriodEnd": "2023-07-31",
"nextRepaymentDueDate": "2023-08-13"
}
}
}