Hoppa till huvudinnehåll

Company Search API

Search for companies (organizations) by name or organization number. Supports partial/substring matching with exact matches prioritized.

Prerequisites

You must have a valid access_token. See Authentication for details on obtaining and refreshing tokens.


Endpoint

GET /api/v3/company/search?q={query}&limit={limit}

Parameters

ParameterTypeRequiredDescription
qstringYesSearch query. Minimum 2 characters. Searches both company name and org number.
limitnumberNoMaximum results to return. Default: 20, max: 100.

Headers

Authorization: Bearer <access_token>

Permissions

Requires COMPANY.R (Read) permission.


Response

Returns an array of matching companies. Exact matches appear first.

[
{
"company_id": "avdQpsQfOeKL",
"name": "Svenskt Friluftsliv",
"org_number": "802013-0410",
"shortname": "SF",
"street": "Storgatan 1",
"zipcode": "11234",
"post": "Stockholm"
}
]

Response Fields

FieldTypeDescription
company_idstringUnique company identifier
namestringFull company name
org_numberstring or nullSwedish organization number
shortnamestring or nullShort display name
streetstring or nullStreet address
zipcodestring or nullPostal code
poststring or nullCity

Sorting

Results are sorted with exact matches first:

  1. Companies where name or org_number exactly matches the query
  2. Companies where name or org_number contains the query (alphabetical)

Error Responses

StatusReasonDescription
400query must be at least 2 charactersSearch query too short
401expiredAccess token expired - refresh it
403ForbiddenUser lacks COMPANY.R permission

Examples

Search by company name (partial)

curl "https://<instance>.memlist.se/api/v3/company/search?q=frilufts" \
-H "Authorization: Bearer <access_token>"

Response:

[
{
"company_id": "avdQpsQfOeKL",
"name": "Svenskt Friluftsliv",
"org_number": "802013-0410",
"shortname": "SF",
"street": "Storgatan 1",
"zipcode": "11234",
"post": "Stockholm"
},
{
"company_id": "bx7KmW9pLe3R",
"name": "Friluftsframjandet Stockholm",
"org_number": "802014-1234",
"shortname": null,
"street": "Parkgatan 5",
"zipcode": "11456",
"post": "Stockholm"
}
]

Search by org number (partial)

curl "https://<instance>.memlist.se/api/v3/company/search?q=802013" \
-H "Authorization: Bearer <access_token>"

Response:

[
{
"company_id": "avdQpsQfOeKL",
"name": "Svenskt Friluftsliv",
"org_number": "802013-0410",
"shortname": "SF",
"street": "Storgatan 1",
"zipcode": "11234",
"post": "Stockholm"
}
]

Search by exact org number

curl "https://<instance>.memlist.se/api/v3/company/search?q=802013-0410" \
-H "Authorization: Bearer <access_token>"

Response:

[
{
"company_id": "avdQpsQfOeKL",
"name": "Svenskt Friluftsliv",
"org_number": "802013-0410",
"shortname": "SF",
"street": "Storgatan 1",
"zipcode": "11234",
"post": "Stockholm"
}
]

When the query exactly matches a company name or org number, only that company is returned.

Limit results

curl "https://<instance>.memlist.se/api/v3/company/search?q=stock&limit=5" \
-H "Authorization: Bearer <access_token>"

Full Integration Example

Node.js

const axios = require('axios');

async function search_companies(access_token, query) {
const res = await axios.get(
`https://<instance>.memlist.se/api/v3/company/search`,
{
params: { q: query, limit: 20 },
headers: { Authorization: `Bearer ${access_token}` }
}
);
return res.data;
}

// Usage
const results = await search_companies(token, 'frilufts');
console.log(`Found ${results.length} companies`);
results.forEach(c => {
console.log(`${c.name} (${c.org_number || 'no org nr'})`);
});

Python

import requests

def search_companies(access_token, query, limit=20):
res = requests.get(
f'https://<instance>.memlist.se/api/v3/company/search',
params={'q': query, 'limit': limit},
headers={'Authorization': f'Bearer {access_token}'}
)
res.raise_for_status()
return res.json()

# Usage
results = search_companies(token, 'frilufts')
for company in results:
print(f"{company['name']} ({company.get('org_number', 'N/A')})")

Autocomplete / Typeahead

For building a search-as-you-type UI, call the endpoint as the user types (debounce 300ms recommended):

let debounce_timer = null;

function on_search_input(query) {
clearTimeout(debounce_timer);
if (query.length < 2) return;

debounce_timer = setTimeout(async () => {
const results = await search_companies(access_token, query);
render_suggestions(results);
}, 300);
}

Notes

  • The search is case-insensitive for company names
  • Org number search is an exact substring match (e.g. "802013" matches "802013-0410")
  • Results are limited to companies the authenticated user has access to
  • The endpoint only returns companies within the user's access scope (not all companies in the system)