Customer Migrations Guide: Post Account Import
Overview
Use this endpoint to add notes to an account.
Some points to note:
-
A note must contain at least one of the fields
body
ordocument_paths
. -
A
created_at
datetime may optionally be provided. Otherwise, it will default to the current local time. -
The
document_paths
refer to the locations in S3 where attached documents are stored. More details on document paths can be found here. -
An optional
is_pinned
boolean can be passed in the payload to control whether this note will be pinned to the top of the Kraken account support site page.
Schema
Responses
The following responses may be returned from the API.
Status code | Description |
---|---|
201 - Created |
If the payload is valid, a [
{
"created_at": "2020-01-01T12:00:00Z",
"body": "Something very important to import.",
"status": "NOTE_CREATION_SUCCESS"
},
{
"created_at": "2020-02-01T12:00:00Z",
"body": "Something else very important to import.",
"status": "NOTE_ALREADY_EXISTS"
}
] |
400 - Bad Request |
If there are validation errors, a |
404 - Not Found |
If an account is not found, then a |
Payloads
Example payload
{
"import_supplier": "TENTACLE_ENERGY",
"external_account_number": "EXTERNAL-1234",
"notes": [
{
"body": "Some important pinned note.",
"is_pinned": true,
"unpin_at": "2020-06-01T12:00:00Z"
},
{
"created_at": "2020-02-01T12:00:00Z",
"body": "Some important note with an attachment.",
"document_paths": [
{
"document_path": "some/path/to/a/document.pdf"
}
]
}
]
}
Overview
Use this endpoint to import financial transactions to an account.
The following optional URL params are available to tweak the behaviour of the API:
check_previously_added
: boolean flag indicating whether to check if a transaction has already been added. Defaults to true.force_add_to_current_statement
: boolean flag. If set to true and the payload contains a transaction that is outside the currently-open statement period, this will modify the transaction date so that it is within the currently-open statement period. This then allows the transaction to be added to the statement instead of throwing an error. A description is added to the transaction to explain this, and a note is pinned to the account. Defaults to true.
Schema
Responses
The following responses may be returned from the API.
Status code | Description |
---|---|
201 - Created |
If the payload is valid, and there were no errors while importing the transactions,
a {
"results": [
{
"status": "TRANSACTION_ALREADY_EXISTS",
"transaction_data": {
"transaction_id": "1",
"transaction_date": "2019-10-01",
"amount": "71.00",
"type": "PAYMENT",
"reason": "GENERAL_CREDIT",
"reference": "reference 1",
"payment_type": "DEBIT_CARD",
"status": "TRANSACTION_IMPORT_SUCCESS"
}
},
{
"status": "TRANSACTION_ADDED_TO_ACCOUNT",
"transaction_data": {
"transaction_id": "2",
"transaction_date": "2019-10-04",
"amount": "180.00",
"type": "PAYMENT",
"reason": "GENERAL_CREDIT",
"reference": "reference 2",
"payment_type": "DEBIT_CARD"
}
}
]
} The following statuses are available:
|
400 - Bad Request |
If there are validation errors, a
For example: {
"status": "TRANSACTION_IMPORT_ERROR",
"error_detail": "Transaction is not within the open statement period.",
"transaction_data": {
"transaction_id": "1",
"transaction_date": "2019-09-28",
"amount": "71.00",
"type": "PAYMENT",
"reason": "GENERAL_CREDIT",
"reference": "reference 1",
"payment_type": "DEBIT_CARD"
}
}
To resolve the error refer to the reason detailed in the |
Payloads
Example payload
{
"import_supplier": "TENTACLE_ENERGY",
"external_account_number": "EXTERNAL-1234",
"transactions": [
{
"transaction_id": "1",
"transaction_date": "2019-10-01",
"amount": 10.0,
"type": "CHARGE",
"reason": "IMPORTED_CHARGE",
"display_note": "Some customer facing note about the charge.",
"reference": "charge-reference-1",
"note": "Some internal note about the charge."
},
{
"transaction_id": "2",
"transaction_date": "2019-10-01",
"amount": 10.0,
"type": "CHARGE",
"reason": "PREPAY_DEBT_ADJUSTMENT",
"display_note": "Some customer facing note about the prepay charge.",
"reference": "prepay-charge-reference-1",
"note": "Some internal note about the prepay charge.",
"to_prepay_meter_serial_number": "Z16N389556"
},
{
"transaction_id": "3",
"transaction_date": "2019-10-01",
"amount": 10.0,
"type": "CREDIT",
"reason": "IMPORTED_CREDIT",
"display_note": "Some customer facing note about the credit.",
"reference": "credit-reference-1",
"note": "Some internal note about the credit."
},
{
"transaction_id": "4",
"transaction_date": "2019-10-01",
"amount": 10.0,
"type": "PAYMENT",
"reason": "ACCOUNT_CHARGE_PAYMENT",
"reference": "payment-reference-1",
"payment_type": "DD_REGULAR_COLLECTION",
"note": "Some internal note about the payment."
},
{
"transaction_id": "5",
"transaction_date": "2019-10-01",
"amount": 10.0,
"type": "REPAYMENT",
"reason": "FULL_CREDIT_REFUND",
"reference": "repayment-reference-1",
"payment_type": "DIRECT_CREDIT",
"note": "Some internal note about the repayment."
},
{
"transaction_id": "6",
"transaction_date": "2019-10-01",
"amount": 10.0,
"type": "SUPPLY_CHARGE",
"display_note": "Some customer facing note about the supply charge.",
"reference": "supply-charge-reference-1",
"product_code": "SOME-PRODUCT-CODE-4321",
"line_items": [
{
"rate_band": "CONSUMPTION_STANDARD",
"start_date": "2019-10-01",
"end_date": "2019-11-01",
"number_of_units": 4.0,
"net_amount": 44.0,
"price_per_unit": 11.0,
"units": [
4.0,
8.0
]
}
],
"tax_items": [
{
"amount": 9.24,
"tax_type": "VAT",
"value_taxed": 44.0,
"rate": 0.21,
"unit_type": "PROPORTION"
}
]
}
]
}
Overview
Use this endpoint to import historical PDF statements onto an account. The historical statements payload contains an optional statement_path
field that points to a location for the PDF statement in S3. For more information on document path parameters, see document paths section.
Schema
Responses
The following responses may be returned from the API.
Status code | Description |
---|---|
201 - Created | If the payload is valid, a 200 OK response will be returned with the validated data as its body. |
400 - Bad Request |
If there are validation errors, a |
Payloads
Example payload
{
"import_supplier": "TENTACLE_ENERGY",
"external_account_number": "EXTERNAL-1234",
"statements": [
{
"bill_period_from_date": "2022-01-01",
"bill_period_to_date": "2022-01-31",
"statement_id": "1",
"issued_date": "2022-02-02",
"number": "1",
"gross_amount": 100,
"statement_path": "path/to/statement-1.pdf"
}
]
}
Overview
Use this endpoint to create a payment instruction for an account.
Schema
Responses
The following responses may be returned from the API.
Status code | Description |
---|---|
201 - Created |
If the payload is valid, a {
"kraken_account_number": "A-C90DC431",
"reference": "THIS-IS-A-FAKE-REFERENCE"
} |
400 - Bad Request |
If there are validation errors, a This error can be returned if we have persistent issues communicating with the upstream payment vendor (we call their API to verify the instruction exists, and retrieve the details to store in Kraken). In this case, the request should not be retried in its current form. |
500 - Internal Server Error |
If an unexpected error occurs, a This error can be returned if we have intermittent issues communicating with the upstream payment vendor (we call their API to verify the instruction exists, and retrieve the details to store in Kraken). In this case, the request should be retried as-is. |
Payloads
Example payload
{
"import_supplier": "TENTACLE_ENERGY",
"external_account_number": "EXTERNAL-1234",
"vendor": "STRIPE",
"instruction_reference": "THIS-IS-A-FAKE-REFERENCE",
"type": "CARD"
}
Overview
Use this endpoint to submit registration flows for meter points on an existing imported account. Note that this endpoint marks meter points to be registered. Kraken will then pick up these meter points and attempt to register them. Given a successful response from this API, it is still possible for the registration process to fail downstream.
The following optional URL params are available to tweak the behaviour of the API:
supply_start_date
: date. If provided, this date will be used as the supply start date in the registration flows sent out by Kraken. If omitted, the earliest valid supply start date will be used.
Responses
The following responses may be returned from the API.
Status code | Description |
---|---|
200 - OK |
If the request is successful, a [
{
"import_supplier_code": "TENTACLE_ENERGY",
"external_account_number": "EXTERNAL-1234",
"meter_points": [
{
"mpxn": "1013004420117",
"status": "REGISTRATION_FLOW_SUCCESS"
},
{
"mpxn": "3406086401",
"error_detail": "TEN not current supplier",
"status": "REGISTRATION_FLOW_ERROR"
}
]
}
] |
404 - Not Found |
If an account is not found, or no meter points are found on the account to
register, then a [
{
"error_detail": "Account not found for EXTERNAL-1234.",
"import_supplier_code": "TENTACLE_ENERGY",
"external_account_number": "EXTERNAL-1234"
}
] |