> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.postnuvia.com/llms.txt.

# Sign Up

POST https://api.postnuvia.com/v0/agent/sign-up
Content-Type: application/json

Create a new agent organization with an inbox and API key. This endpoint is for signing up for the first time. If you've already signed up, you're all set — just use your existing API key.

A 6-digit OTP is sent to the human's email for verification.

`human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint or, for a US-region inbox, claims it in the PostNuvia Console with the API key (see [How do I claim my agent's inbox?](https://docs.postnuvia.com/knowledge-base/claiming-agent-inbox)). There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.

This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.

The returned API key has limited permissions until the organization is verified via the verify endpoint.

**CLI:**
```bash
postnuvia agent sign-up --human-email user@example.com --username my-agent
```

Reference: https://docs.postnuvia.com/api-reference/agent/sign-up

## Servers

- `https://api.postnuvia.com` (prod, default)
- `https://x402.api.postnuvia.com` (prod-x402)
- `https://mpp.api.postnuvia.com` (prod-mpp)
- `https://api.postnuvia.eu` (eu-prod)

## Request

### Body (application/json)

This endpoint expects an AgentSignupRequest.

- `username` (string, required) — Username for the auto-created inbox (e.g. "my-agent" creates my-agent@postnuvia.com).
- `human_email` (string, optional) — Email address of the human who owns the agent. A 6-digit OTP will be sent to this address. Omit it to get a receive-only inbox: it can receive email but cannot send until a human is attached with the attach human endpoint.
- `source` (string, optional) — The SDK, framework, or platform issuing this sign-up (e.g. `postnuvia-python`, `postnuvia-cli`, `postnuvia-mcp`). Identifies the caller — answers "who is signing up". Max 2048 characters.
- `referrer` (string, optional) — The channel that drove this sign-up — where the agent or its developer discovered PostNuvia (e.g. `agent.email`, a partner URL, a campaign tag). Answers "where did this sign-up come from". Max 2048 characters.

## Response

### 200

- `organization_id` (string, required) — ID of the created organization.
- `inbox_id` (string, required) — ID of the auto-created inbox.
- `api_key` (string, required) — API key for authenticating subsequent requests. Store this securely, it cannot be retrieved again.

## Errors

### 400 Validation Error

- `name` (string, required) — Name of error.
- `errors` (any, required) — Validation errors. Each entry has a path and a message identifying the invalid field.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `message` (string, optional) — Error message.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

## Examples

**Request**

```json
{
  "username": "username"
}
```

**Response**

```json
{
  "organization_id": "organization_id",
  "inbox_id": "inbox_id",
  "api_key": "api_key"
}
```

**SDK Code**

```python
import requests

url = "https://api.postnuvia.com/v0/agent/sign-up"

payload = { "username": "username" }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://api.postnuvia.com/v0/agent/sign-up';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"username":"username"}'
};

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.postnuvia.com/v0/agent/sign-up"

	payload := strings.NewReader("{\n  \"username\": \"username\"\n}")

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

	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.postnuvia.com/v0/agent/sign-up")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"username\": \"username\"\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.postnuvia.com/v0/agent/sign-up")
  .header("Content-Type", "application/json")
  .body("{\n  \"username\": \"username\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postnuvia.com/v0/agent/sign-up', [
  'body' => '{
  "username": "username"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.postnuvia.com/v0/agent/sign-up");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"username\": \"username\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["username": "username"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postnuvia.com/v0/agent/sign-up")! 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()
```