APIs
Create Book Repayment
Creates a repayment for a credit account.
Book Repayment creation requests support Idempotency, ensuring that performing multiple identical requests will have the same result as a single request.
| Verb | POST |
| URL | https://api.s.unit.sh/repayments |
| Required Scope | repayments-write or payments-write |
| Data Type | repayment |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| description | string | Repayment description (maximum of 80 characters), this will show up on statement of the counterparty. |
| amount | Integer | The amount (cents) to repay. |
| transactionSummaryOverride | string | If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters). |
| tags Optional | object | Optional. See Tags. |
| idempotencyKey Optional | string | Optional. See Idempotency. |
Relationships
| Name | Type | Description |
|---|---|---|
| account | JSON:API Relationship | The Deposit Account the repayment will be deposited into. |
| creditAccount | JSON:API Relationship | The Credit Account that the repayment is made against. |
| counterpartyAccount | JSON:API Relationship | The Deposit Account the repayment funds are taken from. |
curl -X POST 'https://api.s.unit.sh/repayments'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "bookRepayment",
"attributes": {
"amount": 20,
"description": "test",
"transactionSummaryOverride": "override",
"idempotencyKey": "3a1a33be-4e12-4603-9ed0-820922389fb8"
},
"relationships": {
"account": {
"data": {
"type": "depositAccount",
"id": "10006"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"counterpartyAccount": {
"data": {
"type": "account",
"id": "10008"
}
}
}
}
}'
Response
Response is a JSON:API document.
201 Created
| Name | Type | Description |
|---|---|---|
| data | BookRepayment | The requested resource after the operation was completed. |
{
"data": {
"type": "bookRepayment",
"id": "4",
"attributes": {
"createdAt": "2022-09-19T09:10:09.206Z",
"updatedAt": "2022-09-19T09:10:09.206Z",
"amount": 20,
"status": "Sent"
},
"relationships": {
"counterparty": {
"data": {
"type": "account",
"id": "10008"
}
},
"account": {
"data": {
"type": "account",
"id": "10006"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"org": {
"data": {
"type": "org",
"id": "2"
}
},
"payment": {
"data": {
"type": "payment",
"id": "5"
}
}
}
}
}
Create ACH Repayment
Creates a repayment for a credit account. Both repayment.created and payment.created events are raised when the call is successful.
ACH Repayment creation requests support 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/repayments |
| Required Scope | repayments-write or payments-write |
| Data Type | repayment |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| description | string | Payment description (maximum of 10 characters), also known as Company Entry Description, this will show up on statement of the counterparty. |
| amount | Integer (Cents) | The amount to repay. |
| addenda Optional | string | Optional, additional payment description (maximum of 80 characters), not all institutions present that. |
| tags Optional | object | Optional. See Tags. |
| sameDay Optional | boolean | Optional, default is false. See Same Day ACH. |
| secCode Optional | string | Optional. See Use a custom SEC Code. |
| clearingDaysOverride Optional | number | Optional. See Dynamic Clearing Period. |
| idempotencyKey Optional | string | Optional. See Idempotency. |
Relationships
| Name | Type | Description |
|---|---|---|
| account | JSON:API Relationship | The Deposit Account the repayment will be deposited into. |
| creditAccount | JSON:API Relationship | The Credit Account that the repayment is made against. |
| counterparty | JSON:API Relationship | The ACH Counterparty the repayment will come from. |
curl -X POST 'https://api.s.unit.sh/repayments'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "achRepayment",
"attributes": {
"amount": 200,
"description": "test"
},
"relationships": {
"account": {
"data": {
"type": "depositAccount",
"id": "10076"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10082"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "3"
}
}
}
}
}'
Response
Response is a JSON:API document.
201 Created
| Name | Type | Description |
|---|---|---|
| data | AchRepayment | The requested resource after the operation was completed. |
{
"data": {
"type": "achRepayment",
"id": "1",
"attributes": {
"createdAt": "2022-09-19T09:02:13.343Z",
"updatedAt": "2022-09-19T09:02:13.343Z",
"amount": 200,
"status": "Pending"
},
"relationships": {
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"account": {
"data": {
"type": "account",
"id": "10003"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1"
}
},
"recurringRepayment": {
"data": {
"type": "recurringRepayment",
"id": "4"
}
}
}
}
}
Create Capital Partner ACH Repayment
Creates a repayment for a credit account. Both repayment.created and payment.created events are raised when the call is successful.
Capital Partner Repayment creation requests support 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/repayments |
| Required Scope | repayments-write or payments-write |
| Data Type | repayment |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| description | string | Payment description (maximum of 10 characters), also known as Company Entry Description, this will show up on statement of the counterparty. |
| amount | Integer (Cents) | The amount to repay. |
| addenda Optional | string | Optional, additional payment description (maximum of 80 characters), not all institutions present that. |
| tags Optional | object | Optional. See Tags. |
| sameDay Optional | boolean | Optional, default is false. See Same Day ACH. |
| secCode Optional | string | Optional. See Use a custom SEC Code. |
| idempotencyKey Optional | string | Optional. See Idempotency. |
Relationships
| Name | Type | Description |
|---|---|---|
| creditAccount | JSON:API Relationship | The Credit Account that the repayment is made against. |
| counterparty | JSON:API Relationship | The ACH Counterparty the repayment will come from. |
curl -X POST 'https://api.s.unit.sh/repayments'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "capitalPartnerAchRepayment",
"attributes": {
"amount": 200,
"description": "test"
},
"relationships": {
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10082"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "3"
}
}
}
}
}'
Response
Response is a JSON:API document.
201 Created
| Name | Type | Description |
|---|---|---|
| data | CapitalPartnerAchRepayment | The requested resource after the operation was completed. |
{
"data": {
"type": "capitalPartnerAchRepayment",
"id": "1",
"attributes": {
"createdAt": "2022-09-19T09:02:13.343Z",
"updatedAt": "2022-09-19T09:02:13.343Z",
"amount": 200,
"status": "Pending"
},
"relationships": {
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1"
}
}
}
}
}
Create Capital Partner Book Repayment
Creates a repayment for a credit account.
Book Repayment creation requests support Idempotency, ensuring that performing multiple identical requests will have the same result as a single request.
| Verb | POST |
| URL | https://api.s.unit.sh/repayments |
| Required Scope | repayments-write or payments-write |
| Data Type | repayment |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| description | string | Repayment description (maximum of 80 characters), this will show up on statement of the counterparty. |
| amount | Integer | The amount (cents) to repay. |
| transactionSummaryOverride | string | If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters). |
| tags Optional | object | Optional. See Tags. |
| idempotencyKey Optional | string | Optional. See Idempotency. |
Relationships
| Name | Type | Description |
|---|---|---|
| creditAccount | JSON:API Relationship | The Credit Account that the repayment is made against. |
| counterpartyAccount | JSON:API Relationship | The Deposit Account the repayment funds are taken from. |
curl -X POST 'https://api.s.unit.sh/repayments'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "capitalPartnerBookRepayment",
"attributes": {
"amount": 20,
"description": "test",
"transactionSummaryOverride": "override",
"idempotencyKey": "3a1a33be-4e12-4603-9ed0-820922389fb8"
},
"relationships": {
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"counterpartyAccount": {
"data": {
"type": "account",
"id": "10008"
}
}
}
}
}'
Response
Response is a JSON:API document.
201 Created
| Name | Type | Description |
|---|---|---|
| data | CapitalPartnerBookRepayment | The requested resource after the operation was completed. |
{
"data": {
"type": "capitalPartnerBookRepayment",
"id": "4",
"attributes": {
"createdAt": "2022-09-19T09:10:09.206Z",
"updatedAt": "2022-09-19T09:10:09.206Z",
"amount": 20,
"status": "Sent"
},
"relationships": {
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"counterparty": {
"data": {
"type": "account",
"id": "10008"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"payment": {
"data": {
"type": "payment",
"id": "5"
}
},
"recurringRepayment": {
"data": {
"type": "recurringRepayment",
"id": "4"
}
}
}
}
}
Create External Repayment
Creates an external repayment for a credit account. This is used to record repayments made from sources outside the Unit platform.
External Repayment creation requests support Idempotency, ensuring that performing multiple identical requests will have the same result as a single request.
| Verb | POST |
| URL | https://api.s.unit.sh/repayments |
| Required Scope | repayments-write |
| Data Type | externalRepayment |
| Timeout (Seconds) | 5 |
Attributes
| Name | Type | Description |
|---|---|---|
| description | string | Repayment description (maximum of 80 characters). |
| amount | Integer | The amount (cents) to repay. |
| tags Optional | object | Optional. See Tags. |
| idempotencyKey Optional | string | Optional. See Idempotency. |
Relationships
| Name | Type | Description |
|---|---|---|
| creditAccount | JSON:API Relationship | The Credit Account that the repayment is made against. |
curl -X POST 'https://api.s.unit.sh/repayments'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "externalRepayment",
"attributes": {
"amount": 50000,
"description": "External payment"
},
"relationships": {
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
}
}
}
}'
Response
Response is a JSON:API document.
201 Created
| Name | Type | Description |
|---|---|---|
| data | ExternalRepayment | The requested resource after the operation was completed. |
{
"data": {
"type": "externalRepayment",
"id": "1",
"attributes": {
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"amount": 50000,
"status": "Sent",
"description": "External payment"
},
"relationships": {
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"org": {
"data": {
"type": "org",
"id": "1"
}
}
}
}
}
Return External Repayment
Returns an external repayment that was previously created with Sent status. This is used when the external payment needs to be reversed. When an external repayment is returned, the credit account balance will increase and the available credit limit will decrease.
A repayment.statusChanged event will be raised when an external repayment is returned.
| Verb | POST |
| URL | https://api.s.unit.sh/repayments/{repaymentId}/return |
| Required Scope | repayments-write |
| Data Type | externalRepaymentReturn |
| Timeout (Seconds) | 5 |
Relationships
| Name | Type | Description |
|---|---|---|
| repayment | JSON:API Relationship | The External Repayment to return. |
curl -X POST 'https://api.s.unit.sh/repayments/{repaymentId}/return'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "externalRepaymentReturn",
"relationships": {
"repayment": {
"data": {
"type": "externalRepayment",
"id": "1"
}
}
}
}
}'
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | ExternalRepayment | The requested resource after the operation was completed. |
{
"data": {
"type": "externalRepayment",
"id": "1",
"attributes": {
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T11:00:00.000Z",
"amount": 50000,
"status": "Returned",
"description": "External payment"
},
"relationships": {
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"org": {
"data": {
"type": "org",
"id": "1"
}
}
}
}
}
Get by Id
Get a repayment by id.
| Verb | GET |
| URL | https://api.s.unit.sh/repayments/{id} |
| Required Scope | repayments |
| Timeout (Seconds) | 5 |
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | One of the following types (ACH Repayment, Book Repayment, or External Repayment) | Repayment resource. |
curl -X GET 'https://api.s.unit.sh/repayments/100' \
-H "Authorization: Bearer ${TOKEN}"
List Repayments
List repayments resources. Filtering, paging and sorting can be applied.
| Verb | GET |
| URL | https://api.s.unit.sh/repayments |
| Required Scope | repayments |
| 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[accountId] | string | (empty) | Optional. Filters the results by the specified account id. |
| filter[creditAccountId] | string | (empty) | Optional. Filters the results by the specified credit account id. |
| filter[recurringRepaymentId] | string | (empty) | Optional. Filters the result according to the associated Recurring Repayment id |
| filter[customerId] | string | (empty) | Optional. Filters the results by the specified customer id. |
| filter[status][] | string | (empty) | Optional. Filter repayments by status (Pending, PendingReview, Returned, Sent or Rejected). Usage example: *filter[status][0]=Active |
| filter[type][] | string | (empty) | Optional. Filter repayments by Repayment type. such as (AchRepayment, BookRepayment, ExternalRepayment). Usage example: filter[type][0]=AchRepayment&filter[type][1]=BookRepayment |
| filter[since] | RFC3339 Date string | (empty) | Optional. Filters Repayments that occurred after the specified date. e.g. 2020-01-13T16:01:19.346Z |
| filter[until] | RFC3339 Date string | (empty) | Optional. Filters the Repayments that occurred before the specified date. e.g. 2020-01-02T20:06:23.486Z |
curl -X GET 'https://api.s.unit.sh/repayments?page[limit]=20&page[offset]=10&filter[status]=Pending' \
-H "Authorization: Bearer ${TOKEN}"
Response
Response is a JSON:API document.
200 OK
| Name | Type | Description |
|---|---|---|
| data | Array of Repayments (ACH Repayment, Book Repayment, External Repayment) | Array of repayment resources. |
| meta | JSON object that contains pagination data | Pagination data includes offset, limit and total (estimated total items). |
{
"data": [
{
"type": "achRepayment",
"id": "1",
"attributes": {
"createdAt": "2022-09-19T09:02:13.343Z",
"updatedAt": "2022-09-19T09:02:13.343Z",
"amount": 200,
"status": "Pending"
},
"relationships": {
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"account": {
"data": {
"type": "account",
"id": "10003"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1"
}
}
}
},
{
"type": "bookRepayment",
"id": "2",
"attributes": {
"createdAt": "2022-09-19T09:06:52.566Z",
"updatedAt": "2022-09-19T09:06:52.566Z",
"amount": 20,
"status": "Rejected"
},
"relationships": {
"counterparty": {
"data": {
"type": "account",
"id": "10003"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10002"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10007"
}
},
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"payment": {
"data": {
"type": "payment",
"id": "3"
}
}
}
},
{
"type": "bookRepayment",
"id": "3",
"attributes": {
"createdAt": "2022-09-19T09:07:40.314Z",
"updatedAt": "2022-09-19T09:07:40.314Z",
"amount": 20,
"status": "Rejected"
},
"relationships": {
"counterparty": {
"data": {
"type": "account",
"id": "10003"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10002"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10007"
}
},
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"payment": {
"data": {
"type": "payment",
"id": "4"
}
}
}
},
{
"type": "capitalPartnerAchRepayment",
"id": "4",
"attributes": {
"createdAt": "2022-09-19T09:02:13.343Z",
"updatedAt": "2022-09-19T09:02:13.343Z",
"amount": 200,
"status": "Pending"
},
"relationships": {
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10007"
}
},
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10002"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1"
}
}
}
}
],
"meta": {
"pagination": {
"total": 3,
"limit": 100,
"offset": 0
}
}
}