> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.lettbestilt.no/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.lettbestilt.no/_mcp/server.

# Search delivery addresses

GET https://www.lettbestilt.no/api/v1/address-search

Searches Norwegian addresses (from Kartverket) for your checkout. Use the coordinates as `deliveryLat` and `deliveryLng` for radius-based delivery zones (`RADIUS`), and the postal code as `deliveryPostalCode` for postal-code zones (`POSTAL_CODES`).

If the restaurant does not offer delivery, `hits` is empty. Rate limit: 30 requests per 60 seconds per IP.

Reference: https://docs.lettbestilt.no/api-reference/orders/search-addresses

## Authentication

- `Authorization` header (bearer token, required) — Either this or a trusted browser origin. The restaurant's API key, sent as `Authorization: Bearer lbs_…`. Use it from your server only, never in browser code. Keys are issued per restaurant by LettBestilt.
- `Origin` header (required) — Either this or an API key. No key is needed when the request's `Origin` header is trusted for this restaurant: `https://{slug}.lettbestilt.no`, a verified domain of the restaurant, or a partner origin LettBestilt has bound to the restaurant. Browsers set `Origin` themselves; it is not something you configure. Not accepted by `GET /site-gate`, which requires an API key.

## Request

### Query parameters

- `slug` (string, required) — The restaurant's slug.
- `q` (string, required) — What the customer typed, 3–100 characters. For example a street name and number.

## Response

### 200

Matching addresses.

- `hits` (list of AddressHit, required)

## Errors

### 400 Bad Request Error

`MISSING_SLUG`, or `BAD_REQUEST` when `q` is shorter than 3 or longer than 100 characters.

- `error` (ErrorBody, required)

### 401 Unauthorized Error

`UNAUTHORIZED`: missing or invalid API key, and the request does not come from a trusted browser origin.

- `error` (ErrorBody, required)

### 404 Not Found Error

`RESTAURANT_NOT_FOUND`: no live restaurant has this slug.

- `error` (ErrorBody, required)

### 429 Too Many Requests Error

`RATE_LIMITED`: more than 30 searches in 60 seconds from this IP.

- `error` (ErrorBody, required)

### 502 Bad Gateway Error

`INTERNAL_ERROR`: the address lookup failed.

- `error` (ErrorBody, required)

## Types

### AddressHit

An address from Kartverket, with WGS84 coordinates for delivery-zone matching.

- `label` (string, required) — The full address, for display.
- `street` (string, required) — Street name and number.
- `postalCode` (string, required) — Four-digit postal code. Send it as `deliveryPostalCode`.
- `city` (string, required) — Postal town.
- `lat` (double, required) — Latitude. Send it as `deliveryLat`.
- `lng` (double, required) — Longitude. Send it as `deliveryLng`.

### ErrorBody

- `code` (enum, required) — A machine-readable error code.
  - Allowed values: `MISSING_SLUG`, `MISSING_TOKEN`, `INVALID_JSON`, `INVALID_SUCCESS_URL`, `INVALID_CANCEL_URL`, `VALIDATION_FAILED`, `RESTAURANT_NOT_FOUND`, `ORDER_NOT_FOUND`, `RATE_LIMITED`, `BAD_REQUEST`, `UNAUTHORIZED`, `FORBIDDEN`, `POPUP_NOT_AVAILABLE`, `PRICE_CHANGED`, `PAYMENT_INCOMPLETE`, `PAYMENT_PENDING`, `PAYMENT_PROVIDER_INVALID`, `FULFILLMENT_NOT_ALLOWED`, `IDEMPOTENCY_CONFLICT`, `DINE_IN_DISABLED`, `PARTY_TOO_LARGE`, `TOO_EARLY`, `INTERNAL_ERROR`
- `message` (string, required) — A human-readable explanation. Often in Norwegian, and for business rules usually suitable to show the customer.
- `details` (any, optional) — Extra data for some codes, for example `issues` for `VALIDATION_FAILED` or the totals for `PRICE_CHANGED`.

## Examples

**Response**

```json
{
  "hits": [
    {
      "label": "Storgata 1, 3126 Tønsberg",
      "street": "Storgata 1",
      "postalCode": "3126",
      "city": "Tønsberg",
      "lat": 59.2676,
      "lng": 10.4076
    }
  ]
}
```

**SDK Code**

```python Orders_searchAddresses_example
import requests

url = "https://www.lettbestilt.no/api/v1/address-search"

querystring = {"q":"q","slug":"slug"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Orders_searchAddresses_example
const url = 'https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Orders_searchAddresses_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Orders_searchAddresses_example
require 'uri'
require 'net/http'

url = URI("https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Orders_searchAddresses_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Orders_searchAddresses_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Orders_searchAddresses_example
using RestSharp;

var client = new RestClient("https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Orders_searchAddresses_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://www.lettbestilt.no/api/v1/address-search?q=q&slug=slug")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```