# Search registered companies

Find registered companies by name or organisation number in Norway and Sweden. Use unavailable to distinguish an unavailable register from no matches.

POST https://api.brigg.app/v1/operations/customers.SearchRegisteredCompanies

## Access & visibility

Allow `customers.SearchRegisteredCompanies` on your API key.

**Acting member required.** Send `Brigg-Act-As` with an [approved member account ID](https://developer.brigg.app/authentication#member-delegation). The key supplies permissions; the member selects whose data is used.

The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | A name, or an organisation number. At most 200 characters. |

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `hits` | array of [RegisteredCompany](#registeredcompany-response-hits) | Yes | Matching company records, in the returned search order. |
| `unavailable` | string | No | The register's own reason it did not answer a number lookup (`not_configured`, `unauthorized`, `unavailable`). |

### RegisteredCompany · response.hits[]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `org_number` | string | Yes | Official organization number as text; preserve leading zeros. |
| `display_name` | string | Yes | Human-readable name used for this record. |
| `name` | string | Yes | Display name. |
| `city` | null or string | Yes | Postal town or city. |

## Errors & retries

This operation reads data. It needs no idempotency key and can be retried after a transient failure.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. Supply Brigg-Act-As with a member authorized by the key’s delegation grant. The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |

## Next steps

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Example request

Fictional values. Replace IDs and business details with values from your workspace.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/customers.SearchRegisteredCompanies' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  --data-raw '{
  "query": "Northstar"
}'
```

#### TypeScript


```typescript
const actAs = process.env.BRIGG_ACT_AS;
if (!actAs) throw new Error("Set BRIGG_ACT_AS to an approved member account ID.");

const response = await fetch("https://api.brigg.app/v1/operations/customers.SearchRegisteredCompanies", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
  },
  body: JSON.stringify({
    "query": "Northstar"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "query": "Northstar"
}
request = Request(
    "https://api.brigg.app/v1/operations/customers.SearchRegisteredCompanies",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Brigg-Act-As": os.environ["BRIGG_ACT_AS"],
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "hits": [
    {
      "org_number": "999999999",
      "display_name": "Northstar Consulting AS",
      "name": "Northstar Consulting AS",
      "city": null
    }
  ]
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 200,
      "description": "A name, or an organisation number."
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "query": "Northstar"
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "hits": {
      "type": "array",
      "items": {
        "title": "RegisteredCompany",
        "type": "object",
        "properties": {
          "org_number": {
            "type": "string",
            "description": "Official organization number as text; preserve leading zeros."
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable name used for this record."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "city": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ],
            "description": "Postal town or city."
          }
        },
        "required": [
          "org_number",
          "display_name",
          "name",
          "city"
        ],
        "additionalProperties": false
      },
      "description": "Matching company records, in the returned search order."
    },
    "unavailable": {
      "type": "string",
      "description": "The register's own reason it did not answer a number lookup (`not_configured`, `unauthorized`, `unavailable`)."
    }
  },
  "required": [
    "hits"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "hits": [
        {
          "org_number": "999999999",
          "display_name": "Northstar Consulting AS",
          "name": "Northstar Consulting AS",
          "city": null
        }
      ]
    }
  ]
}
```

