API reference
Account
The account in the key's mode: seller data printed on invoices, KSeF connection state and plan usage. Test and live mode have separate data.
The Account object
The account in the key's mode: seller data, KSeF connection and plan usage.
Attributes
idstringrequiredAccount id.
Prefix
acct_objectstringrequiredObject type.
Always
accountlivemodebooleanrequiredThe key's mode.
emailstring | nullAccount email.
platformstringapiorwoocommerce(plugin account).One of:
api,woocommerceksef_environmentstringrequiredKSeF environment of this mode.
One of:
test,demo,prodsellerobjectrequiredSeller data printed on invoices.
Show fields
nipstring | nullSeller NIP.
namestring | nullSeller name.
address_line1string | nullStreet and number.
address_line2string | nullPostal code and city.
seller_configuredbooleanrequiredWhether the seller data is complete.
ksef_connectedbooleanrequiredWhether the KSeF certificate or token of this mode works.
ksef_check_errorstring | nullWhat is wrong with the KSeF connection, or
null.planobjectrequiredPlan and usage this month.
Show fields
namestringrequiredPlan name (
Unlimitedin test mode).monthly_limitinteger | nullrequiredMonthly invoice limit, or
nullfor none.used_this_monthintegerrequiredInvoices issued this month.
{
"id": "acct_Xy7Qw2Er4Ty6Ui8Op0As2Df4",
"object": "account",
"livemode": false,
"email": "sklep@example.com",
"platform": "woocommerce",
"ksef_environment": "test",
"seller": {
"nip": "4235405606",
"name": "Sklep Woo sp. z o.o.",
"address_line1": "ul. Testowa 1",
"address_line2": "00-001 Warszawa"
},
"seller_configured": true,
"ksef_connected": true,
"ksef_check_error": null,
"plan": {
"name": "Unlimited",
"monthly_limit": null,
"used_this_month": 12
}
}Retrieve the account
GET /v1/account
Seller data, KSeF connection and plan usage in the key's mode. The WooCommerce plugin's "Test connection" button calls this endpoint.
Responses
- 200The account.
- 401Missing or invalid key:
api_key_missingapi_key_invalid - 403Live mode is not enabled yet:
live_mode_disabled - 429Rate limit exceeded, wait
Retry-Afterseconds:rate_limited
curl https://app.ksefshop.pl/v1/account \
-H "Authorization: Bearer $KSEF_API_KEY"<?php
$ch = curl_init('https://app.ksefshop.pl/v1/account');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('KSEF_API_KEY'),
],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
$data = json_decode($body, true);
if ($status >= 400) {
throw new RuntimeException($data['error']['code'] . ': ' . $data['error']['message']);
}
echo var_export($data['seller_configured'], true), ' ', var_export($data['ksef_connected'], true), PHP_EOL;const res = await fetch("https://app.ksefshop.pl/v1/account", {
headers: {
Authorization: `Bearer ${process.env.KSEF_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
console.log(data.seller_configured, data.ksef_connected);import os
import requests
resp = requests.get(
"https://app.ksefshop.pl/v1/account",
headers={
"Authorization": f"Bearer {os.environ['KSEF_API_KEY']}",
},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data["seller_configured"], data["ksef_connected"]){
"id": "acct_Xy7Qw2Er4Ty6Ui8Op0As2Df4",
"object": "account",
"livemode": false,
"email": "sklep@example.com",
"platform": "woocommerce",
"ksef_environment": "test",
"seller": {
"nip": "4235405606",
"name": "Sklep Woo sp. z o.o.",
"address_line1": "ul. Testowa 1",
"address_line2": "00-001 Warszawa"
},
"seller_configured": true,
"ksef_connected": true,
"ksef_check_error": null,
"plan": {
"name": "Unlimited",
"monthly_limit": null,
"used_this_month": 12
}
}{
"error": {
"type": "authentication_error",
"code": "api_key_invalid",
"message": "The API key is wrong, revoked, or the account is disabled.",
"doc_url": "https://ksefshop.pl/api/errors#api_key_invalid"
}
}{
"error": {
"type": "permission_error",
"code": "live_mode_disabled",
"message": "Live mode is not enabled for this account yet.",
"doc_url": "https://ksefshop.pl/api/errors#live_mode_disabled"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests; wait for Retry-After seconds.",
"doc_url": "https://ksefshop.pl/api/errors#rate_limited"
}
}