Skip to content

Finance Payout Specification Example

Detta exempel visar hur man hämtar Finance Payout Specifications med specifika query-parametrar för paginering och dataprojektion.

Finance Payout Specifications ger detaljerad finansiell transaktionsdata inklusive kapitalbelopp, räntekostnader, borgenärskommissioner och momsberäkningar. Varje specifikation representerar en finansiell post som bidrar till den övergripande utbetalningsberäkningen för Creditors, visar uppdelningen av insamlade medel per kategori (kapital, ränta, påminnelseavgifter) och deras nuvarande bearbetningstillstånd.

Alla API-requests kräver en giltig autentiseringstoken i X-API-Key header. För detaljer om autentiseringsprocessen och tokenhantering, se Authentication documentation.

I denna guide kommer vi att använda AuthTokenProvider-klassen (dokumenterad i autentiseringsguiden) för att hantera tokenhantering.

Hämta Finance Payout Specifications

Hämta Finance Payout Specifications med Finance Payout Specification endpoint med Pagination and Queries:

typescript
const token = await auth.getValidToken()

const query = encodeURIComponent(JSON.stringify({}))
const projection = encodeURIComponent(
  JSON.stringify({
    booking_date: 1,
    article: 1,
    state: 1,
    total_amount: 1,
    amount: 1,
    vat_amount: 1,
    finance_category: 1,
    payout_reference: 1,
    reference_number: 1,
    invoice_number: 1,
  })
)

const response = await axios.get(
  `https://api-sandbox.amili.se/finance--payout-specifications?page=1&max_results=20&sort=-_created&projection=${projection}&where=${query}`,
  {
    headers: {
      'X-API-Key': token,
    },
  }
)
python
import json

token = auth.get_valid_token()

query = json.dumps({})
projection = json.dumps({
  "booking_date": 1,
  "article": 1,
  "state": 1,
  "total_amount": 1,
  "amount": 1,
  "vat_amount": 1,
  "finance_category": 1,
  "payout_reference": 1,
  "reference_number": 1,
  "invoice_number": 1
})

response = requests.get(
  'https://api-sandbox.amili.se/finance--payout-specifications',
  params={
    'page': 1,
    'max_results': 20,
    'sort': '-_created',
    'projection': projection,
    'where': query
  },
  headers={'X-API-Key': token}
)
response.raise_for_status()
result = response.json()

Svaret kommer att vara:

json
{
  "_items": [
    {
      "_id": "507f1f77bcf86cd799439011",
      "amount": 60.0,
      "vat_amount": 15.0,
      "total_amount": 75.0,
      "article": "reminder",
      "state": "reminder",
      "booking_date": "Wed, 11 Jun 2025 00:00:00 GMT",
      "finance_category": "creditor_commission",
      "_updated": "Wed, 11 Jun 2025 14:00:18 GMT",
      "_created": "Wed, 11 Jun 2025 14:00:18 GMT",
      "_etag": "a1b2c3d4e5f678901234567890123456",
      "invoice_number": "INV-2025-020",
      "reference_number": "25020"
    },
    {
      "_id": "507f1f77bcf86cd799439012",
      "amount": 1064,
      "vat_amount": 0.0,
      "total_amount": 1064.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Wed, 11 Jun 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Wed, 11 Jun 2025 14:00:18 GMT",
      "_created": "Wed, 11 Jun 2025 14:00:17 GMT",
      "_etag": "b2c3d4e5f67890123456789012345678",
      "invoice_number": "INV-2025-020",
      "reference_number": "25020"
    },
    {
      "_id": "507f1f77bcf86cd799439013",
      "amount": 10000,
      "vat_amount": 0.0,
      "total_amount": 10000.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Thu, 05 Jun 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Thu, 05 Jun 2025 11:30:14 GMT",
      "_created": "Thu, 05 Jun 2025 11:30:14 GMT",
      "_etag": "c3d4e5f6789012345678901234567890",
      "invoice_number": "INV-2025-019",
      "reference_number": "25019"
    },
    {
      "_id": "507f1f77bcf86cd799439014",
      "amount": 3209,
      "vat_amount": 0.0,
      "total_amount": 3209.0,
      "article": "interest",
      "state": "reminder",
      "booking_date": "Thu, 05 Jun 2025 00:00:00 GMT",
      "finance_category": "interest",
      "_updated": "Thu, 05 Jun 2025 11:30:14 GMT",
      "_created": "Thu, 05 Jun 2025 11:30:14 GMT",
      "_etag": "d4e5f6789012345678901234567890ab",
      "invoice_number": "INV-2025-018",
      "reference_number": "25018"
    },
    {
      "_id": "507f1f77bcf86cd799439015",
      "amount": 12000,
      "vat_amount": 0.0,
      "total_amount": 12000.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Thu, 05 Jun 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Thu, 05 Jun 2025 11:30:14 GMT",
      "_created": "Thu, 05 Jun 2025 11:30:14 GMT",
      "_etag": "e5f6789012345678901234567890abcd",
      "invoice_number": "INV-2025-018",
      "reference_number": "25018"
    },
    {
      "_id": "507f1f77bcf86cd799439016",
      "amount": 3014,
      "vat_amount": 0.0,
      "total_amount": 3014.0,
      "article": "interest",
      "state": "reminder",
      "booking_date": "Tue, 03 Jun 2025 00:00:00 GMT",
      "finance_category": "interest",
      "_updated": "Tue, 03 Jun 2025 11:13:15 GMT",
      "_created": "Tue, 03 Jun 2025 11:13:15 GMT",
      "_etag": "f6789012345678901234567890abcdef",
      "invoice_number": "INV-2025-017",
      "reference_number": "25017"
    },
    {
      "_id": "507f1f77bcf86cd799439017",
      "amount": 3700,
      "vat_amount": 0.0,
      "total_amount": 3700.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Tue, 03 Jun 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Tue, 03 Jun 2025 11:13:15 GMT",
      "_created": "Tue, 03 Jun 2025 11:13:15 GMT",
      "_etag": "789012345678901234567890abcdef12",
      "invoice_number": "INV-2025-017",
      "reference_number": "25017"
    },
    {
      "_id": "507f1f77bcf86cd799439018",
      "amount": 1000,
      "vat_amount": 0.0,
      "total_amount": 1000.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Tue, 03 Jun 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Tue, 03 Jun 2025 06:17:12 GMT",
      "_created": "Tue, 03 Jun 2025 06:17:12 GMT",
      "_etag": "89012345678901234567890abcdef1234",
      "invoice_number": "INV-2025-016",
      "reference_number": "25016"
    },
    {
      "_id": "507f1f77bcf86cd799439019",
      "amount": 20,
      "vat_amount": 0.0,
      "total_amount": 20.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Fri, 09 May 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Fri, 09 May 2025 13:03:19 GMT",
      "_created": "Fri, 09 May 2025 13:03:19 GMT",
      "_etag": "9012345678901234567890abcdef1234",
      "invoice_number": "INV-2025-015",
      "reference_number": "25015"
    },
    {
      "_id": "507f1f77bcf86cd799439020",
      "amount": 70,
      "vat_amount": 0.0,
      "total_amount": 70.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Fri, 09 May 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Fri, 09 May 2025 13:03:18 GMT",
      "_created": "Fri, 09 May 2025 13:03:18 GMT",
      "_etag": "012345678901234567890abcdef1234",
      "invoice_number": "INV-2025-014",
      "reference_number": "25014"
    },
    {
      "_id": "507f1f77bcf86cd799439021",
      "amount": 25,
      "vat_amount": 0.0,
      "total_amount": 25.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Fri, 09 May 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Fri, 09 May 2025 13:03:18 GMT",
      "_created": "Fri, 09 May 2025 13:03:18 GMT",
      "_etag": "123456789012345678901234567890ab",
      "invoice_number": "INV-2025-013",
      "reference_number": "25013"
    },
    {
      "_id": "507f1f77bcf86cd799439022",
      "amount": 50,
      "vat_amount": 0.0,
      "total_amount": 50.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Fri, 09 May 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Fri, 09 May 2025 13:03:18 GMT",
      "_created": "Fri, 09 May 2025 13:03:18 GMT",
      "_etag": "23456789012345678901234567890abc",
      "invoice_number": "INV-2025-012",
      "reference_number": "25012"
    },
    {
      "_id": "507f1f77bcf86cd799439023",
      "amount": 12500,
      "vat_amount": 0.0,
      "total_amount": 12500.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Tue, 29 Apr 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Tue, 29 Apr 2025 06:40:15 GMT",
      "_created": "Tue, 29 Apr 2025 06:40:15 GMT",
      "_etag": "3456789012345678901234567890abcd",
      "invoice_number": "INV-2025-011",
      "reference_number": "25011"
    },
    {
      "_id": "507f1f77bcf86cd799439024",
      "amount": 6250,
      "vat_amount": 0.0,
      "total_amount": 6250.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Mon, 28 Apr 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Mon, 28 Apr 2025 19:00:16 GMT",
      "_created": "Mon, 28 Apr 2025 19:00:16 GMT",
      "_etag": "456789012345678901234567890abcdef",
      "invoice_number": "INV-2025-010",
      "reference_number": "25010"
    },
    {
      "_id": "507f1f77bcf86cd799439025",
      "amount": 112.0,
      "vat_amount": 0.0,
      "total_amount": 112.0,
      "article": "interest",
      "state": "reminder",
      "booking_date": "Mon, 28 Apr 2025 00:00:00 GMT",
      "finance_category": "interest",
      "_updated": "Mon, 28 Apr 2025 15:40:17 GMT",
      "_created": "Mon, 28 Apr 2025 15:40:17 GMT",
      "_etag": "56789012345678901234567890abcdef",
      "invoice_number": "INV-2025-009",
      "reference_number": "25009"
    },
    {
      "_id": "507f1f77bcf86cd799439026",
      "amount": 60.0,
      "vat_amount": 15.0,
      "total_amount": 75.0,
      "article": "reminder",
      "state": "reminder",
      "booking_date": "Mon, 28 Apr 2025 00:00:00 GMT",
      "finance_category": "creditor_commission",
      "_updated": "Mon, 28 Apr 2025 15:40:17 GMT",
      "_created": "Mon, 28 Apr 2025 15:40:17 GMT",
      "_etag": "6789012345678901234567890abcdef1",
      "invoice_number": "INV-2025-009",
      "reference_number": "25009"
    },
    {
      "_id": "507f1f77bcf86cd799439027",
      "amount": 1875.0,
      "vat_amount": 0.0,
      "total_amount": 1875.0,
      "article": "capital",
      "state": "reminder",
      "booking_date": "Mon, 28 Apr 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Mon, 28 Apr 2025 15:40:17 GMT",
      "_created": "Mon, 28 Apr 2025 15:40:17 GMT",
      "_etag": "789012345678901234567890abcdef12",
      "invoice_number": "INV-2025-009",
      "reference_number": "25009"
    },
    {
      "_id": "507f1f77bcf86cd799439028",
      "amount": 500,
      "vat_amount": 0.0,
      "total_amount": 500.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Thu, 24 Apr 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Thu, 24 Apr 2025 08:40:18 GMT",
      "_created": "Thu, 24 Apr 2025 08:40:18 GMT",
      "_etag": "89012345678901234567890abcdef12",
      "invoice_number": "INV-2025-008",
      "reference_number": "25008"
    },
    {
      "_id": "507f1f77bcf86cd799439029",
      "amount": 5000,
      "vat_amount": 0.0,
      "total_amount": 5000.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Thu, 24 Apr 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Thu, 24 Apr 2025 08:00:19 GMT",
      "_created": "Thu, 24 Apr 2025 08:00:19 GMT",
      "_etag": "9012345678901234567890abcdef12",
      "invoice_number": "INV-2025-008",
      "reference_number": "25008"
    },
    {
      "_id": "507f1f77bcf86cd799439030",
      "amount": 1064,
      "vat_amount": 0.0,
      "total_amount": 1064.0,
      "article": "capital",
      "state": "initializing",
      "booking_date": "Thu, 24 Apr 2025 00:00:00 GMT",
      "finance_category": "capital",
      "_updated": "Thu, 24 Apr 2025 07:50:16 GMT",
      "_created": "Thu, 24 Apr 2025 07:50:16 GMT",
      "_etag": "012345678901234567890abcdef1234",
      "invoice_number": "INV-2025-008",
      "reference_number": "25008"
    }
  ],
  "_meta": {
    "page": 1,
    "max_results": 20,
    "total": 162
  }
}