curl --request GET \
--url https://api.watchdog.no/v1/invoices/{id}/coding \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/invoices/{id}/coding', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.watchdog.no/v1/invoices/{id}/coding"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"state": "ready",
"open_field_count": 123,
"nothing_to_post": true,
"suggesting": true,
"dimensions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "department",
"name": "<string>",
"is_active": true
}
],
"lines": [
{
"line_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"line_number": 123,
"total_excluding_vat": "<string>",
"account": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>",
"name": "<string>",
"is_active": true,
"default_vat_code_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vat_locked": true,
"allowed_vat_code_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"required_dimension_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"vat_code": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>",
"rate": "<string>",
"is_active": true
},
"dimension_values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>",
"is_active": true
}
],
"state": "ready",
"open_fields": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"not_booked": true,
"expected_fields": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"dimension_needs": [
{
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"need": "required",
"alternatives": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>",
"invoice_count": 123
}
]
}
],
"problems": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reason": "inactive"
}
],
"source": "manual",
"fields": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "suggested",
"reason": {
"proposer": "precedent",
"rule": "same_line",
"invoice_count": 123,
"certainty": "sure"
}
}
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by_user_id": "<string>"
}
],
"groups": [
{
"ledger_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vat_code_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_value_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"line_item_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"total_excluding_vat": "<string>"
}
],
"voucher": {
"status": "draft",
"source_system": "<string>",
"system_name": "<string>",
"number": "<string>",
"url": "<string>",
"company_currency": "<string>",
"postings": [
{
"kind": "cost",
"account": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
},
"vat_code": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
},
"dimensions": [
{
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension": "<string>",
"value_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
}
],
"amount": "<string>",
"amount_gross": "<string>",
"currency": "<string>",
"company_amount": "<string>",
"company_amount_gross": "<string>",
"line_item_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
],
"differences": [
{
"posting": 123,
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension": "<string>",
"booked": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
},
"watchdog": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
}
}
]
}
}{
"error": {
"code": "validation_error",
"message": "The request is invalid. details lists up to 20 field errors. Request bodies are limited to 2 MiB.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "The bearer token is missing or invalid.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied. The error code says why: forbidden, token_disabled, organization_required, insufficient_role or mfa_required.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Wait for the Retry-After delay before retrying.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Temporarily unavailable. Retry after the Retry-After delay, when provided.",
"request_id": "req_example"
}
}Get invoice coding
Coding is how the invoice posts in the accounting system: an account, a VAT code and dimension values per line, from the organization’s vocabulary, which its accounting connections sync (list it with listLedgerAccounts, listVatCodes and listDimensionValues). Returns each line’s coding with what is missing or cannot be used, the invoice’s state, the lines grouped by identical coding, and the voucher it posts as: Watchdog’s draft summed from the coding, or once booked the accounting system’s postings with where they differ from it. In organizations with accounts payable, an ordinary invoice can be approved only when its state is ready. Letters expose approved unrecognized costs through letter_charge_scope and use those effective amounts for coding.
curl --request GET \
--url https://api.watchdog.no/v1/invoices/{id}/coding \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/invoices/{id}/coding', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.watchdog.no/v1/invoices/{id}/coding"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"state": "ready",
"open_field_count": 123,
"nothing_to_post": true,
"suggesting": true,
"dimensions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "department",
"name": "<string>",
"is_active": true
}
],
"lines": [
{
"line_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"line_number": 123,
"total_excluding_vat": "<string>",
"account": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>",
"name": "<string>",
"is_active": true,
"default_vat_code_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vat_locked": true,
"allowed_vat_code_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"required_dimension_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"vat_code": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>",
"rate": "<string>",
"is_active": true
},
"dimension_values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>",
"is_active": true
}
],
"state": "ready",
"open_fields": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"not_booked": true,
"expected_fields": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"dimension_needs": [
{
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"need": "required",
"alternatives": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>",
"invoice_count": 123
}
]
}
],
"problems": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reason": "inactive"
}
],
"source": "manual",
"fields": [
{
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "suggested",
"reason": {
"proposer": "precedent",
"rule": "same_line",
"invoice_count": 123,
"certainty": "sure"
}
}
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by_user_id": "<string>"
}
],
"groups": [
{
"ledger_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vat_code_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_value_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"line_item_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"total_excluding_vat": "<string>"
}
],
"voucher": {
"status": "draft",
"source_system": "<string>",
"system_name": "<string>",
"number": "<string>",
"url": "<string>",
"company_currency": "<string>",
"postings": [
{
"kind": "cost",
"account": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
},
"vat_code": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
},
"dimensions": [
{
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension": "<string>",
"value_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
}
],
"amount": "<string>",
"amount_gross": "<string>",
"currency": "<string>",
"company_amount": "<string>",
"company_amount_gross": "<string>",
"line_item_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
],
"differences": [
{
"posting": 123,
"field": "account",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension": "<string>",
"booked": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
},
"watchdog": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"name": "<string>"
}
}
]
}
}{
"error": {
"code": "validation_error",
"message": "The request is invalid. details lists up to 20 field errors. Request bodies are limited to 2 MiB.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "The bearer token is missing or invalid.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied. The error code says why: forbidden, token_disabled, organization_required, insufficient_role or mfa_required.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Wait for the Retry-After delay before retrying.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Temporarily unavailable. Retry after the Retry-After delay, when provided.",
"request_id": "req_example"
}
}Authorizations
Headers
Query Parameters
Response
The invoice’s coding.
The worst state of its lines; unavailable without accounts payable or synced accounts; booked once the accounting system has posted its booking (see voucher), which is its coding: no lines, nothing to fill and nothing suggested.
ready, needs_input, invalid, unavailable, booked