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

# 전화번호 발급

POST https://api.claw-ops.com/v1/accounts/{accountId}/numbers
Content-Type: application/json

번호 풀에서 전화번호를 자동 발급합니다. 계정별 번호 할당량(quota)이 설정되어 있으며, 한도 초과 시 422 에러가 반환됩니다.

Reference: https://docs.claw-ops.com/api-레퍼런스/claw-ops-api/numbers/register-number

## Authentication

- `Authorization` header (bearer token, required) — API Key를 Bearer 토큰으로 전달

## Request

### Path parameters

- `accountId` (string, required) — 계정 ID

### Body (application/json)

- `webhookUrl` (string, optional) — 수신 전화 처리용 Webhook URL (선택)
- `webhookMethod` (enum, optional, default: POST) — Webhook HTTP 메서드 (선택, 기본 POST)
  - Allowed values: `POST`, `GET`
- `webhookHeaders` (map from string to string, optional, nullable) — 인바운드 webhook 호출 시 추가될 HTTP 헤더 (선택). 키는 "X-" prefix 필수 (case-insensitive), reserved 헤더(X-Signature, X-Forwarded-*, X-Real-IP) 거절. 최대 10 entries, key ≤ 64 bytes, value ≤ 2048 bytes, ASCII printable.
- `statusCallback` (string, optional, nullable) — 수신(inbound) 통화 상태 webhook URL (선택). 이 번호로 걸려오는 통화의 상태 전이(ringing → answered → completed[+busy/rejected])를 POST 통지. 발신(outbound)은 통화 생성 시 statusCallback 으로 별도 관리.
- `statusCallbackEvents` (string, optional, nullable) — 구독할 상태 이벤트(공백 구분, 선택). 미지정 시 `initiated ringing answered completed` 가 적용됩니다. `transfer`(호전환 진행 상황)는 기본에 포함되지 않으므로 받으려면 직접 나열하세요. 전체 목록은 [Status Callback](/docs/webhooks/status).

## Response

### 201

번호 발급 성공

- `number` (string, optional) — 전화번호
- `source` (string, optional) — 번호 출처 (pool 등)
- `webhookUrl` (string, optional, nullable)
- `webhookMethod` (enum, optional)
  - Allowed values: `POST`, `GET`
- `callContextUrl` (string, optional, nullable) — routingType='agent'에서 Managed Agent 시작 전에 통화별 CallContext를 조회하는 동기 endpoint.
- `routingType` (enum, optional) — Agent 미연결/거부 시 fallback 라우팅. 'webhook' = webhookUrl 호출, 'sip' = sipEndpointId 의 OriginationRoute 로 외부 PBX 다이얼, 'softphone' = sipCredentialId 의 등록 단말로 착신(Kamailio usrloc fork), 'forward' = forwardTo(보유 번호)로 내부 착신전환, 'callflow' = callFlowId 의 콜 플로우(결정적 ARS)가 인입을 받음, 'agent' = agentId 의 매니지드 에이전트가 받음.
  - Allowed values: `webhook`, `sip`, `softphone`, `forward`, `callflow`, `agent`
- `sipEndpointId` (string, optional, nullable) — routingType='sip' 일 때 사용할 SipEndpoint id. 그 외 라우팅에서는 null.
- `sipCredentialId` (string, optional, nullable) — routingType='softphone' 일 때 착신할 등록 SIP credential(단말) id. 그 외 라우팅에서는 null.
- `forwardTo` (string, optional, nullable) — routingType='forward' 일 때 내부 착신전환 대상 번호(같은 계정 보유 번호). 그 외 라우팅에서는 null.
- `callFlowId` (string, optional, nullable) — routingType='callflow' 일 때 인입을 처리할 콜 플로우 id. 그 외 라우팅에서는 null.
- `agentId` (string, optional, nullable) — routingType='agent' 일 때 인입을 처리할 매니지드 에이전트 id. 그 외 라우팅에서는 null.
- `webhookHeaders` (map from string to string, optional, nullable) — Inbound webhook 호출 시 추가될 HTTP 헤더. 키는 "X-" prefix 필수 (case-insensitive), reserved 헤더(X-Signature, X-Forwarded-*, X-Real-IP) 거절. 최대 10 entries, key ≤ 64 bytes, value ≤ 2048 bytes, ASCII printable. null 전송 시 헤더 제거, 미포함 시 변경 없음.
- `statusCallback` (string, optional, nullable) — 수신(inbound) 통화 상태 webhook URL. 발신은 통화 생성 시 statusCallback 으로 별도 관리.
- `statusCallbackEvents` (string, optional, nullable) — 구독할 상태 이벤트(공백 구분). 미지정 시 기본 전체.
- `numberType` (enum, optional) — 번호 유형. did = 일반 번호, representative = 대표번호.
  - Allowed values: `did`, `representative`
- `dictionaryId` (string, optional, nullable) — 부착된 받아쓰기 사전 id. null 이면 이 번호로 걸려온 통화 전사에 계정 기본 사전을 사용.
- `createdAt` (datetime, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "number": "07012340001",
  "source": "pool",
  "webhookUrl": "https://my-app.com/voice",
  "webhookMethod": "POST",
  "callContextUrl": "https://api.example.com/integrations/clawops/call-context",
  "routingType": "webhook",
  "sipEndpointId": null,
  "sipCredentialId": null,
  "forwardTo": null,
  "callFlowId": null,
  "agentId": null,
  "webhookHeaders": {
    "X-Webhook-Token": "tenant-secret-abc123"
  },
  "statusCallback": "https://my-app.com/call-status",
  "statusCallbackEvents": "ringing answered completed",
  "numberType": "did",
  "dictionaryId": null,
  "createdAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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.post("https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.claw-ops.com/v1/accounts/AC1a2b3c4d/numbers")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```