> 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}/assignment-links
Content-Type: application/json

엔드유저가 방문하여 번호를 발급받을 수 있는 일회용 링크를 생성합니다.

**전제조건**: 계정에 `external_assignment` 애드온이 활성화되어 있어야 합니다. 비활성 시 403 `FEATURE_DISABLED`.

**슬롯 한도**: 발급된 회선 + 사용되지 않은 pending 링크 수의 합이 플랜 maxAgents를 초과하면 422 `QUOTA_EXCEEDED`.

한 링크는 1회만 소비되며, 소비되거나 만료/취소되면 재사용할 수 없습니다.

Reference: https://docs.claw-ops.com/api-레퍼런스/claw-ops-api/assignment-links/create-assignment-link

## 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)
  - Allowed values: `POST`, `GET`
- `note` (string, optional) — 내부 메모
- `webhookHeaders` (map from string to string, optional, nullable) — 발급 시 phone_number 로 prefill 될 헤더. 키는 "X-" prefix 필수 (case-insensitive), reserved 헤더(X-Signature, X-Forwarded-*, X-Real-IP) 거절. 최대 10 entries, key ≤ 64 bytes, value ≤ 2048 bytes, ASCII printable. null 전송 시 헤더 제거, 미포함 시 변경 없음.

## Response

### 201

링크 생성 성공

- `token` (string, optional) — linkId와 동일한 값
- `url` (string, optional) — 엔드유저용 공개 URL
- `expiresAt` (datetime, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "token": "string",
  "url": "string",
  "expiresAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

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

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/assignment-links';
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/assignment-links"

	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/assignment-links")

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/assignment-links")
  .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/assignment-links', [
  '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/assignment-links");
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/assignment-links")! 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()
```