---
updatedAt: 2026-10-01T11:25:19.000Z
agentTools:
  projectIndex: https://docs.pensopay.com/llms.txt
---

# Getting Started With The API

Everything you need before your first request to the pensopay API.

The pensopay API lets you create and manage payments, payouts and subscriptions from your own
system. This page covers what you need before your first request.

# Base URL

All requests go to:

```text
https://api.pensopay.com/v2
```

# Authentication

The API uses bearer tokens. Create a token in [the pensopay app](https://app.pensopay.com),
where you can also revoke it again. Send the token in the `Authorization` header of every
request:

```http
GET /v2/account HTTP/1.1
Host: api.pensopay.com
Authorization: Bearer <token>
```

A request without a valid token is rejected with `401 Unauthorized`.

> 🚧 Keep your token secret
>
> A token gives full access to your account through the API. Only use it from your server, never
> in a browser or an app.

# Requests and responses

Request and response bodies are JSON. Send `Content-Type: application/json` when a request has
a body.

Amounts are integers in the currency's smallest unit. For example, `500` in `DKK` is 5.00 kr.

# Your first payment

Create a payment with `POST /v2/payments`:

```bash
curl https://api.pensopay.com/v2/payments \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 500,
    "currency": "DKK",
    "order_id": "1234",
    "testmode": true
  }'
```

`"testmode": true` makes it a test payment, so no real money is moved. The **Test Payments**
page lists the test cards you can pay with.

# Lists and pages

Endpoints that return a list, such as `GET /v2/payments`, return one page at a time. Choose the
page with these query parameters:

| Parameter  | Description                                                             |
| ---------- | ----------------------------------------------------------------------- |
| `page`     | The page to return. Starts at `1`.                                      |
| `per_page` | How many items per page. The allowed range is listed for each endpoint. |

The response holds the items in `data` and information about the pages in `meta`:

```json
{
  "data": [],
  "meta": {
    "current_page": 1,
    "last_page": 4,
    "per_page": 15,
    "total": 52
  }
}
```

# Next steps

* **API versions:** how to choose the version of the API your integration uses.
* **Callback:** get notified when a payment changes.
* **Payment states:** the life of a payment, from created to captured.
* **Error handling:** what each status code means.