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

# Get serviceable postcodes for a hub

GET https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes

Reference: https://api-docs.zippd.com/serviceable-hubs/get-serviceable-postcodes

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `page` (integer, optional, default: 1) — The index of the page to retrieve from the results listing.
- `hub_id` (integer, required) — Hub identifier

## Response

### 200

Paginated list of serviceable postcodes

- `data` (list of object, required)
  - `id` (integer, required) — The ID of the postcode record.
  - `postcode` (string, required) — The full postcode.
  - `city` (string, required) — The city in which the postcode is located.
  - `country` (object, required)
    - `id` (integer, required) — The ID of the country record.
    - `name` (string, required) — The country's name in English.
    - `code` (string, required) — The country code in format ISO 3166-1 alpha-2.
- `links` (object, required)
  - `first` (string, optional) — URL to the first page of the listing results.
  - `last` (string, optional) — URL to the last page of the listing results.
  - `prev` (string, optional, nullable) — URL to the previous page of the listing results, based on the current page requested.
  - `next` (string, optional, nullable) — URL to the next page of the listing results, based on the current page requested.
- `meta` (object, required)
  - `current_page` (integer, optional) — The current page of the pagination.
  - `last_page` (integer, optional) — The very last available page of the pagination.
  - `per_page` (integer, optional) — The number of items listed per page.
  - `from` (integer, optional) — The item index at which this page of the listing starts, relative to the total number of items.
  - `to` (integer, optional) — The item index at which this page of the listing ends, relative to the total number of items.
  - `total` (integer, optional) — The total number of items that the request found.
  - `path` (string, optional) — The canonical path for the resource type being listed.
- `hub` (object, required) — The details of the hub found by this request.
  - `id` (integer, required) — The ID of the hub.
  - `name` (string, required) — The name of the hub.
  - `updated_at` (datetime, required)
  - `version` (integer, required)

## Errors

### 422 Unprocessable Entity Error

Validation error

- `any`

## Examples

**Response**

```json
{
  "data": [
    {
      "id": 1,
      "postcode": "string",
      "city": "string",
      "country": {
        "id": 437,
        "name": "United Kingdom",
        "code": "GB"
      }
    }
  ],
  "links": {
    "first": "https://sandbox-api.deliveryapp.com/api/v1/[resource URI]?page=1",
    "last": "https://sandbox-api.deliveryapp.com/api/v1/[resource URI]?page=4",
    "prev": "https://sandbox-api.deliveryapp.com/api/v1/[resource URI]?page=1",
    "next": "https://sandbox-api.deliveryapp.com/api/v1/[resource URI]?page=3"
  },
  "meta": {
    "current_page": 2,
    "last_page": 4,
    "per_page": 15,
    "from": 16,
    "to": 30,
    "total": 57,
    "path": "https://sandbox-api.deliveryapp.com/api/v1/[resource URI]"
  },
  "hub": {
    "id": 3745,
    "name": "BHM3",
    "updated_at": "2024-01-15T09:30:00Z",
    "version": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes"

querystring = {"hub_id":"1"}

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

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

print(response.json())
```

```javascript
const url = 'https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1';
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
package main

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

func main() {

	url := "https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1"

	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
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1")

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
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.deliveryapp.com/api/v1/serviceable-postcodes?hub_id=1")! 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()
```