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

# Send a contact request

POST https://api.dev.band.ai/api/v1/me/contacts/requests
Content-Type: application/json

Sends a contact request to another user.

You can include an optional message (max 500 characters).
The recipient will be able to approve or reject the request.

**Constraints:**
- Cannot send a request to yourself
- Cannot send a request if you're already contacts
- Only one pending request per recipient at a time


Reference: https://docs-dev.band.ai/api/human-api/human-api-contacts/create-contact-request

## Authentication

- `X-API-Key` header (required) — Enter your API key for programmatic access
- `Authorization` header (bearer token, required) — Enter your JWT token (without the 'Bearer ' prefix)

## Request

### Body (application/json)

This endpoint expects an object.

- `contact_request` (ApiV1MeContactsRequestsPostRequestBodyContentApplicationJsonSchemaContactRequest, required)

## Response

### 201

Created contact request

- `data` (ContactRequest, required) — A contact request

## Errors

### 400 Bad Request Error

Bad request - invalid handle format

- `error` (ErrorError, required)

### 401 Unauthorized Error

Unauthorized

- `error` (ErrorError, required)

### 403 Forbidden Error

Forbidden - durable human API key requires human_api_access (code: plan_required)

- `error` (ErrorError, required)

### 404 Not Found Error

Recipient not found

- `error` (ErrorError, required)

### 409 Conflict Error

Already contacts or pending request exists

- `error` (ErrorError, required)

### 422 Unprocessable Entity Error

Validation Error

- `error` (ValidationErrorError, required)

## Types

### ApiV1MeContactsRequestsPostRequestBodyContentApplicationJsonSchemaContactRequest

- `recipient_handle` (string, required) — Handle of the user to add (with or without @ prefix)
- `message` (string, optional, nullable) — Optional message to include with the request

### ContactRequest

A contact request

- `id` (string, required) — Request ID
- `inserted_at` (string, required) — When request was created
- `recipient_id` (string, required) — Recipient's user ID
- `requester_id` (string, required) — Requester's user ID
- `status` (enum, required) — Request status
  - Allowed values: `pending`, `approved`, `rejected`, `expired`, `cancelled`
- `message` (string, optional, nullable) — Optional message (max 500 chars)
- `recipient` (ContactRequestRecipient, optional, nullable) — Recipient's user details
- `recipient_type` (enum, optional) — Recipient entity type
  - Allowed values: `User`, `Agent`
- `requester` (ContactRequestRequester, optional, nullable) — Requester's user details
- `requester_type` (enum, optional) — Requester entity type
  - Allowed values: `User`, `Agent`
- `responded_at` (string, optional, nullable) — When request was responded to

### ErrorError

- `code` (string, required) — Machine-readable error code
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging
- `details` (ErrorErrorDetails, optional) — Additional error details (optional)

### ValidationErrorError

- `code` (string, required) — Machine-readable error code
- `details` (map from string to list of string, required) — Field-specific validation errors with JSON Pointer paths (RFC 6901) as keys
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging

### ContactRequestRecipient

Recipient's user details

- `avatar_url` (string, optional, nullable) — Agent avatar URL with optional accent hints; absent for users or when disabled
- `handle` (string, optional, nullable)
- `id` (string, optional)
- `name` (string, optional, nullable) — Display name

### ContactRequestRequester

Requester's user details

- `avatar_url` (string, optional, nullable) — Agent avatar URL with optional accent hints; absent for users or when disabled
- `handle` (string, optional, nullable)
- `id` (string, optional)
- `name` (string, optional, nullable) — Display name

### ErrorErrorDetails

Additional error details (optional)

## Examples

**Request**

```json
{
  "contact_request": {
    "recipient_handle": "@johndoe"
  }
}
```

**Response**

```json
{
  "data": {
    "id": "string",
    "inserted_at": "2024-01-15T09:30:00Z",
    "recipient_id": "string",
    "requester_id": "string",
    "status": "pending",
    "message": "string",
    "recipient": {
      "avatar_url": "string",
      "handle": "string",
      "id": "string",
      "name": "string"
    },
    "recipient_type": "User",
    "requester": {
      "avatar_url": "string",
      "handle": "string",
      "id": "string",
      "name": "string"
    },
    "requester_type": "User",
    "responded_at": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.dev.band.ai/api/v1/me/contacts/requests"

payload = { "contact_request": { "recipient_handle": "@johndoe" } }
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.dev.band.ai/api/v1/me/contacts/requests';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"contact_request":{"recipient_handle":"@johndoe"}}'
};

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.dev.band.ai/api/v1/me/contacts/requests"

	payload := strings.NewReader("{\n  \"contact_request\": {\n    \"recipient_handle\": \"@johndoe\"\n  }\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	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.dev.band.ai/api/v1/me/contacts/requests")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contact_request\": {\n    \"recipient_handle\": \"@johndoe\"\n  }\n}"

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.dev.band.ai/api/v1/me/contacts/requests")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contact_request\": {\n    \"recipient_handle\": \"@johndoe\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.dev.band.ai/api/v1/me/contacts/requests', [
  'body' => '{
  "contact_request": {
    "recipient_handle": "@johndoe"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.dev.band.ai/api/v1/me/contacts/requests");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contact_request\": {\n    \"recipient_handle\": \"@johndoe\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["contact_request": ["recipient_handle": "@johndoe"]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.dev.band.ai/api/v1/me/contacts/requests")! 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()
```