# Quick start

# Step 1: Get API key

All requests to Proff API is authenticated using an API key associated with your account. If you are using an API key that is expired or have exceeded its usage limit the API will return an error message.

If you don't have an API key yet, contact us.

Make sure you keep your API key secret, it should be considered as a password. Do not share it with others and make sure you don't commit it to a Git repository. If the key is accidentally shared, contact us so we can deactivate it and generate a new one.

# Step 2: Make a request to the API

We recommend you use the API documentation page (opens new window) to make a test request with your API key.

  1. Click Authorize

Authorize

  1. Enter your API key and click Authorize and then Close.

Token

TIP

It is important that you include "Token" and a space before your API key.

The key is not validated at this step and it is not stored anywhere but in your browser. You can now test all endpoints and operations from this page.

  1. Search by company name

Scroll to the section RegisterCompany and find the operation GET ​/api​/companies​/register​/{country}. Click Try it out. You will now have the possibility to enter values of all possible parameters and make a request.

RegisterCompany

The only mandatory field here is country. Use NO as value here.

TIP

You can use the same API, with the same API key to search and lookup entities in other countries too.

If you don't enter any more parameters, all public organizations will be returned. Scroll down to query and enter "proff". This will search in registered company names and other names the company uses for marketing purposes. Scroll down and click the button Execute.

You will now see what URL has been used and how to make the same request using curl. You will also see the HTTP status code and, if the API key is valid, the response returned from the API.

Sample

Congratulations, you've made your first request to Proff API! The next step is to do this from an application.

# Step 3: Make a request to the API from an application

How to make a request to Proff API from an application depends on your choice of programming language and HTTP library. Here is an example using JavaScript (NodeJS) and axios:

const axios = require('axios')

// Your API token
const API_TOKEN = process.env.API_TOKEN

// Use any library you like for HTTP requests
const httpClient = axios.create({
    baseURL: 'https://api.proff.no/api/companies/register/NO',
    headers: {'Authorization': `Token ${API_TOKEN}`},
    responseType: 'json'
});

(async () => {
    const response = await httpClient.get('?query=proff');
    response.data.companies.forEach(c => console.log(c.name))
})();

Example of invoking and running this program:

$ API_TOKEN='<YOUR_SECRET_API_KEY>' node search.js
PROFF AS
PROFF LYDUTLEIE Arne Grimstad
PROFF NAPRAPATI BENT HALDEN JØRGENSEN
ANDRIUS PROFF BYGG ANDRIUS JASINSKAS
...