> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nixflex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create and verify an agent with the API

> Create a Nixflex agent from your server, save its identifier, verify the configuration and connect an owned number without duplicating an uncertain request.

**FIXED · agent** For a different inbound opening on each number, use Dynamic greeting and put the opening in that number’s custom\_prompt. Fixed welcome\_message text, spoken language, pickup delay and general call timezone are shared agent settings. Use separate agents when those must differ. A booking timezone changes calendar times only.

**NOT OFFERED → do this instead · number** A number cannot override fixed agent settings. Use its dynamic opening for business-specific wording. Use different agents for different fixed settings.

**YOU CAN CHANGE · agent** Choose the supported catalogue voice and an eligible route. Select manual speech terms or configure structured values to extract from transcripts.

**SCOPE · number** Choose a complete primary and backup voice pair on the number. It overrides the agent pair as a whole. To use the saved agent pair, set voice\_pair\_inherit to true. Setting the older voice\_id field can clear the agent’s catalogue key, and a pair that is only partly set can be unavailable. Never choose by alias precedence.

Group numbers by the knowledge and agent settings their customers need. Attribute each customer’s usage to its verified business number.

Agents are unlimited. There is no fee per agent. Customers pay only for usage (minutes and texts). Many customers can use one shared agent, each with its own number and number prompt. Use separate agents only for different knowledge or agent settings. List page size, knowledge-base quotas and simultaneous-call limits do not cap agent count.

For a different greeting per business, keep Dynamic greeting on (the default) and put the opening line in that number’s custom\_prompt. For example, “Start every call with: Thank you for calling Oak and Stone”.

[Read the compact AI rules](https://docs.nixflex.com/ai-rules.md#agents-voices)

Create the agent, retain its ID and verify its saved settings before connecting customer traffic.

Audience: **Developers** · Credential: **Server only**

**The important part**

* Create is a write; a lost response can conceal success.
* An agent contains shared behaviour and knowledge, while a number owns routing and channels.
* A created agent does not confirm that a real call will work.

[Business guide](https://docs.nixflex.com/guides/business/agents.md) · [Glossary](https://docs.nixflex.com/guides/glossary.md)

## Before you send

Keep `NIXFLEX_API_KEY` on the server for the intended account. Choose a clear name and reviewed instructions. Creating an agent does not import a phone number or connect a calendar.

## Create once

```javascript Node HTTP theme={"dark"}
const response = await fetch('https://api.nixflex.com/v1/agents', {
  method: 'POST', redirect: 'error', signal: AbortSignal.timeout(30_000),
  headers: {Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type':'application/json'},
  body: JSON.stringify({name:'Willow reception', system_prompt:'Answer business enquiries using reviewed facts. Ask the team when a fact is missing.'}),
});
const result = await response.json();
if (!response.ok) throw new Error(`HTTP ${response.status}: ${result.error?.code || 'unknown'}`);
// Persist the returned agent ID privately before continuing.
```

See [Create agent](https://docs.nixflex.com/api-reference/agents/create.md) for the response envelope and all accepted fields. There is no general Idempotency-Key replay guarantee. If the response is lost, inspect the owned agent list and reconcile the intended creation before another POST. A matching display name alone is not a unique identity.

## Verify and connect

Read the saved agent by ID. Set the voice, language and conversation controls you actually need, respecting the [agent fields](https://docs.nixflex.com/api-reference/agents/contract.md). Connect an owned number through [number setup](https://docs.nixflex.com/guides/developer/phone-numbers/import-and-connect.md), then read its assigned agent and channel switches.

Keep frequent essential facts in the main instructions and detailed material in the agent’s Knowledge base. SMS and Web agent instructions live in their own number-level settings; do not assume an agent prompt change rewrites them.

## Check behaviour

Use the dashboard Knowledge Test for factual retrieval, then a controlled call for the full interaction. Check the actual calendar, SMS or transfer result for an enabled action. Do not treat an accepted call as successful delivery.

| Problem | Recovery |
| - | - |
| Invalid field | Correct the field using the endpoint reference. |
| Personal session cannot write | Use an authorised Owner or Admin workflow. |
| Unknown creation result | Reconcile the existing list; do not retry POST automatically. |
| Agent appears inactive | Read the saved state before routing more calls. |

Deleting an agent soft-disables it. It does not erase history, delete a number or close the account.

## Next steps

* [Write instructions](https://docs.nixflex.com/best-practices/prompting-guide.md)
* [Set number overrides](https://docs.nixflex.com/concepts/agent-inheritance.md)
* [Test in the dashboard](https://docs.nixflex.com/guides/business/agents/test.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.