# Create New Contact

`POST /contacts`

Create a new contact for a given phone number.

## Authentication

Send your API key in the `PINNACLE-API-KEY` header.

## Request body

Request payload for creating a new contact record.

Required.

Content type: `application/json`.

### Fields

- `description` — `string`, optional. New notes or details for your contact.
- `email` — `string`, optional. New email address for your contact.
- `name` — `string`, optional. New name for your contact.
- `tags` — `string[]`, optional. New tags for your contact.
- `phoneNumber` — `string`. Phone number to save for your contact, in E.164 format.

### Example

```json
{
  "description": "Primary messaging workflow",
  "email": "avery@example.com",
  "name": "Acme Support",
  "tags": [
    "vip"
  ],
  "phoneNumber": "+14155550142"
}
```

## Responses

### 200

Successfully created the contact.

Content type: `application/json`. Schema: `ContactId`.

- `id` — `string`. Unique ID of the created contact. This identifier is a string that always begins with the prefix `co_`, for example: `co_1234567890`.

Example:

```json
{
  "id": "co_1234567890"
}
```

### 400

Validation failed. The payload has missing required fields and/or invalid types.

See https://zod.dev/error-formatting for more information.

Content type: `application/json`. Schema: `object`.

- `description` — `string`. Human-readable summary of validation failures.
- `errors` — `object`. Structured dictionary of issues containing two main sections:
- `errors`: Array of global validation errors not tied to specific fields
- `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

Example:

```json
{
  "description": "✖ Invalid input: expected string, received number\n  → at example_field",
  "errors": {
    "errors": [
      "Unrecognized key: 'extraKey'"
    ],
    "properties": {
      "example_field": {
        "errors": [
          "Invalid input: expected string, received NaN"
        ]
      }
    }
  }
}
```

### 401

The request lacks valid authentication credentials or the provided credentials are invalid.

Ensure you're including a valid API key in the request headers and that your account has the necessary permissions to access this endpoint.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Invalid API key."
}
```

### 403

Your subscription does not include access to this feature.

This occurs when attempting to use functionality that requires a higher subscription tier.
Please upgrade your subscription to access this feature.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Your subscription does not include access to this feature."
}
```

### 500

An unexpected error occurred on Pinnacle's servers while processing your request.

If this error persists, please contact support with the request details.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "An unexpected error occurred while processing your request."
}
```

## SDK examples

### TypeScript

```typescript
import { PinnacleClient } from "rcs-js";

const client = new PinnacleClient({
  apiKey: process.env.PINNACLE_API_KEY!,
});

await client.contacts.create({
    phoneNumber: "phoneNumber"
});
```

### Python

```python
import os
from rcs import Pinnacle

client = Pinnacle(
    api_key=os.environ["PINNACLE_API_KEY"],
)

client.contacts.create(
    phone_number="phoneNumber",
)
```

### Ruby

```ruby
require "rcs"

client = Pinnacle::Client.new(
  api_key: ENV.fetch("PINNACLE_API_KEY")
)

client.contacts.create(phone_number: "phoneNumber")
```

## Machine-readable schema

[OpenAPI 3.1 JSON](https://docs.pinnacle.sh/openapi.json)
