***

title: create
slug: /reference/typescript/rest/phone-numbers/create
description: Purchase a phone number.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Purchase a phone number. The fields in the request body depend on the number being
purchased (typically obtained from a prior `search()` call).

<EndpointSchemaSnippet endpoint="POST /api/relay/rest/phone_numbers" />

## **Response Example**

<EndpointResponseSnippet endpoint="POST /api/relay/rest/phone_numbers" />

## **Example**

```typescript {13}
import { RestClient } from "@signalwire/sdk";

const client = new RestClient({
  project: "your-project-id",
  token: "your-api-token",
  host: "your-space.signalwire.com"
});

// Purchase the first available number from a search
const available = await client.phoneNumbers.search({ areacode: "512", max_results: 1 });
const numbers = available.data ?? [];
if (numbers.length > 0) {
  const purchased = await client.phoneNumbers.create({ number: numbers[0].number });
  console.log("Purchased:", purchased.number);
}
```