---
updatedAt: 2025-09-09T13:14:41.000Z
agentTools:
  projectIndex: https://developer.farpay.io/llms.txt
---

# How to use the API

This guide covers everything you need to get started with the FarPay API, including obtaining your API key and understanding request requirements.

## Quick Start

### Generating an API Key

To access FarPay's API, you need to generate an API key:

1. Log in to your FarPay account.
2. Navigate to **Settings → API Access.**
3. Click **Generate**.
4. Save the generated key securely — you will use it to authenticate your API requests.

### Common for all requests

All requests must comply to following terms.

<Table>
  <thead>
    <tr>
      <th>
        Term
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        API Key
      </td>

      <td>
        A key - the identifyer, that is added to the header of each request in FarPay API
      </td>
    </tr>

    <tr>
      <td>
        Accept
      </td>

      <td>
        The accept term in the header, asks the API to deliver the results in a given format.
        Available formats are:

        * `application/json`
        * `application/xml`
      </td>
    </tr>
  </tbody>
</Table>

### Using the API Key

To authenticate your request, include the API key in the `X-API-KEY` header of your HTTP request. Here’s an example using curl:

```http
`curl -X GET \
  --header 'Accept: application/json' \
  --header 'X-API-KEY: {api-key}' \
  'https://api.farpay.io/v2/customers'
```

Replace `{api-key}` with your actual API key.

### Error Handling

If the provided API key is invalid or unauthorized, the API will return the following error message:

```json
{
  "Message": "9000::X-API-KEY is not authenticated"
}
```

#### Possible Reasons

Possible Reasons:

* The API key has been deleted.
* The API key has been regenerated, and you're using an old one.

### Best Practices

Although API keys do not expire, it is recommended to rotate them at least every 6 months.

Store your API keys securely and avoid exposing them in public code or logs.

Remove any unused or compromised keys from the FarPay dashboard immediately.

## Core Concepts

| Resource          | Description                                        | Endpoint         | Status     |
| ----------------- | -------------------------------------------------- | ---------------- | :--------- |
| **Customers**     | Manage customer information and payment agreements | `/customers`     |            |
| **Orders**        | Create payment flows and agreements                | `/orders`        |            |
| **Invoices**      | Generate and manage invoices                       | `/invoices`      |            |
| **Payments**      | Track payment history and process refunds          | `/payments`      |            |
| **Agreements**    | Manage recurring payment instruments               | `/agreements`    |            |
| **Subscriptions** | Handle subscription-based recurring payments       | `/subscriptions` | Deprecated |
| **Payment Sets**  | Access aggregated payment information              | `/paymentsets`   |            |
| **Deliveries**    | Upload files for batch processing                  | `/deliveries`    |            |

## Payment Methods Supported

* **MobilePay** - Mobile payment solution
* **Cards** - Visa, MasterCard, Dankort
* **Betalingsservice** - Direct debit for private customers
* **Leverandørservice** - Direct debit for businesses

## Date Formats

* **Input dates**: `YYYY-MM-DD`
* **Response dates**: `YYYY-MM-DDTHH:mm:ssZ`