# API Snippets

### Airtable

#### Airtable Script Rechnungs als Bezahlt prüfen

Ziel des Scriptes ist es den Zahlungs einer Rechnung anhand der Rechnungsnummer zu prüfen. Rechnungen werden hier in Airtable verwaltet. Über den [transactions/match](https://api.kontoflux.io/#/operations/matchTransactions) Endpunkt können wir hier einfach und zuverlässig mit speziellen Matching Algorithmen bauen – die uns sogar ein Confidence Score übermitteln, den wir nutzen um sicherzustellen, dass nur relevante Ergebnisse einbezogen werden.\
\
Danach Updaten wir in Airtable-Manier unsere Datensätzen, sobald sicher gestellt wurde, dass die Rechnungen mit einer Transaktion übereinstimmen.

<figure><img src="/files/58Sgn36arhg2nliuvQPD" alt=""><figcaption></figcaption></figure>

```typescript
const invoice = input.config(); // invoice.invoiceNumber, recordId, amount
let response = await fetch('https://api.kontoflux.io/v1/yourWorkspaceId/transactions/match?query='+encodeURI(invoice.invoiceNumber), {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'sk-y0ur-ap1-k3y'
    },
});
let transactions = await response.json();

transactions.forEach((transaction)=>{
    if(transaction.score > 0.85){ // only if the probabillity is high enough

        if(Math.abs(transaction.amount) == invoice.amount){ // even the amount matches, fantastic!
            return output.set("recordId", invoice.recordId);            
        } else {
            // might notify that the amount paid is mismatching the invoice amount
        }
    }
});
```

### Ninox

#### Ninox Script Rechnungseingang prüfen

Ziel des Scriptes ist es den Zahlungseingang einer Rechnung anhand der Rechnungsnummer zu prüfen. Rechnungen werden hier in Ninox erstellt und verwaltet. Über den [transactions/match](https://api.kontoflux.io/#/operations/matchTransactions) Endpunkt können wir hier einfach und zuverlässig mit speziellen Matching Algorithmen bauen – die uns sogar ein Confidence Score übermitteln, den wir nutzen um sicherzustellen, dass nur relevante Ergebnisse einbezogen werden.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kontoflux.io/api/api-snippets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
