> For the complete documentation index, see [llms.txt](https://apidocs.arionbanki.is/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.arionbanki.is/business-apis/authentication/production.md).

# Production

Authenticating yourself on the live environment.

The main difference between integrating the services on a "live" environment versus sandbox environment is that the live environment requires a "búnaðarskilríki" certificate. Another main difference is that when using the OAuth authentication, you use the user's credentials (username and password) instead of the portal-generated token in the sandbox environment.

## Create an application

To get started with the service, first create a new *Business API* application on the [Arion developer portal](https://developer.arionbanki.is).&#x20;

<figure><img src="https://4095428740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWRKRXR147Y5hgO0DneWg%2Fuploads%2FZOnVOtdugSl9f2Nt1nHU%2Fimage.png?alt=media&amp;token=76891b3a-fd80-48c3-9e63-098ddf6092ac" alt=""><figcaption></figcaption></figure>

## Get your API key

When a new application is created, it starts in the sandbox environment. However, in this quick start tutorial we want to get started with production data. To do so, go live with your application by pressing the "Go Live" button.&#x20;

<figure><img src="https://4095428740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWRKRXR147Y5hgO0DneWg%2Fuploads%2FGfNY8H60i3I7n7ORTJEU%2Fimage.png?alt=media&amp;token=29ad9619-e86f-4775-aa66-69eef72ebfce" alt=""><figcaption></figcaption></figure>

When going live, you might be asked to upload a certificate, this would be the búnaðarskilríki certificate needed to access the service. On this page you can either upload the .cer file with the button highlighted in green below or paste the raw base64 string without the BEGIN and END sections.&#x20;

<figure><img src="https://4095428740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWRKRXR147Y5hgO0DneWg%2Fuploads%2Fh3IhEzU1KwIcW4KZ42y0%2Fimage.png?alt=media&amp;token=ab1eaf8e-e5e7-4478-ba11-cba83176524c" alt=""><figcaption></figcaption></figure>

Once you have gone live with your application, you can navigate to the "Production" tab of your application and fetch your **API key** there.

<figure><img src="https://4095428740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWRKRXR147Y5hgO0DneWg%2Fuploads%2FneUiyJHUaWAQoLcsR7FB%2Fimage.png?alt=media&amp;token=e36f7e2c-5944-42a1-95a0-03705de02e69" alt=""><figcaption></figcaption></figure>

Note: A common error for integrators connecting for the first time is to use the sandbox API key when trying to connect to the production (live) endpoints, make sure you are using the production API key when doing so :wink:

## Certificate

For use of the API in the production environment, a *Búnaðarskilríki* certificate is required. Búnaðarskilríki certificates can be aquired from Auðkenni who is the issuer those certificates.&#x20;

Further information on Búnaðarskilríki can be found here: <https://www.audkenni.is/upplysingar/fyrirtaekjaskilriki/um-bunadarskilriki>

**Note that the certificate is required both when calling the authorization endpoint and the service endpoints.**&#x20;

## Authorization

The Business API uses OAuth2.0 authentication. All the information needed to fetch an auth token are listed below:&#x20;

<table><thead><tr><th width="176">Field</th><th>Value</th></tr></thead><tbody><tr><td>Auth URL</td><td><a href="https://apigw.arionbanki.is/oauth/v2/oauth-token">https://apigw.arionbanki.is/oauth/v2/oauth-token</a></td></tr><tr><td>Grant type</td><td>client_credentials</td></tr><tr><td>Client ID</td><td>[Arion username]</td></tr><tr><td>Client Secret</td><td>[Arion password]</td></tr><tr><td>Scope</td><td>openid b2b</td></tr></tbody></table>

Note that the ClientID and Client Secret used in the authentication is the username and password of the user that is fetching their data, these are the same credentials that the user uses to access the Arion online bank (netbanki).&#x20;

Take a look at how you might call this method using our official libraries, or via `curl`:

{% tabs %}
{% tab title="curl" %}

```
curl --cert /path/to/certificate.pfx:<password> --cert-type P12 \
     -H "accept: text/plain" \
     -d "grant_type=client_credentials" \
     -d "client_id=[EnterCompanyUsername]" \
     -d "client_secret=[EnterCompanyPassword]" \
     -d "scope=openid b2b" \
     -X POST https://apigw.arionbanki.is/oauth/v2/oauth-token

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://apigw.arionbanki.is/oauth/v2/oauth-token"
cert_path = "/path/to/certificate.pfx"
cert_password = "[EnterCompanyCertificatePassword]"

# Form data
data = {
    "grant_type": "client_credentials",
    "client_id": "[EnterCompanyUsername]",
    "client_secret": "[EnterCompanyPassword]",
    "scope": "openid b2b"
}

# Send request with the .pfx certificate
response = requests.post(url, data=data, headers={"Accept": "text/plain"}, cert=(cert_path, cert_password))

print(response.text)

```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require("axios");
const fs = require("fs");

const url = "https://apigw.arionbanki.is/oauth/v2/oauth-token";
const certPath = "/path/to/certificate.pfx";
const certPassword = "[EnterCompanyCertificatePassword]";

const formData = new URLSearchParams();
formData.append("grant_type", "client_credentials");
formData.append("client_id", "[EnterCompanyUsername]");
formData.append("client_secret", "[EnterCompanyPassword]");
formData.append("scope", "openid b2b");

axios.post(url, formData, {
    headers: { "Accept": "text/plain" },
    httpsAgent: new (require("https").Agent)({
        pfx: fs.readFileSync(certPath),
        passphrase: certPassword
    })
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        // Fetch certificate from store, you other find types if that is preferred
        X509Store store = new X509Store(StoreLocation.CurrentUser);
        store.Open(OpenFlags.ReadOnly);
        X509Certificate2Collection cers = store.Certificates.Find(X509FindType.FindByThumbprint, "[EnterCompanyCertificateThumbprint]", false);

        // Adding certificate to handler
        var handler = new HttpClientHandler();
        handler.ClientCertificates.Add(cers[0]);
        store.Close();

        // Get HttpClient
        HttpClient clientWithCertificate = new HttpClient(handler);

        var url = "https://apigw.arionbanki.is/oauth/v2/oauth-token";
        clientWithCertificate.DefaultRequestHeaders.Add("accept", "text/plain");

        var content = new FormUrlEncodedContent(new[]
        {
            new KeyValuePair<string, string>("grant_type", "client_credentials"),
            new KeyValuePair<string, string>("client_id", "[EnterCompanyUsername]"),
            new KeyValuePair<string, string>("client_secret", "[EnterCompanyPassword]"),
            new KeyValuePair<string, string>("scope", "openid b2b")
        });
        
        var response = await clientWithCertificate.PostAsync(url, content);
        var responseString = await response.Content.ReadAsStringAsync();
        Console.WriteLine(responseString);
    }
}
```

{% endtab %}
{% endtabs %}

The base URLs for production are

* <https://apigw.arionbanki.is/cards>
* <https://apigw.arionbanki.is/claims>
* <https://apigw.arionbanki.is/documents>

## Use Our Sample Clients

Check out our sample clients if you want an example of usage:

{% columns %}
{% column %}
Here's a guide on how to get Postman set up against our services:

{% content-ref url="/pages/Qf4oYxCJ7tayE0YVbEMa" %}
[Postman Examples](/business-apis/examples/postman-examples.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Here's an example of a .NET client if you prefer that;

{% content-ref url="/pages/R5GwZIHeTwiKK8nehodk" %}
[.NET Sample Clients](/business-apis/examples/.net-sample-clients.md)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}
