---
docId: doc_44f3c56ba43f46f39af8dac597b9e85c
title: Quickstart
description: Get an API key, create an agent and chat with it in three steps, with the API or the SDK.
---

<script>
  import { Steps, Ways, Note } from '$lib/components';
</script>

# Quickstart

Create an agent and send it your first message with the API or SDK. To use your AI assistant, follow the [MCP quickstart](/mcp/quickstart).

**Before you start:** a Platica account. For the SDK, Node.js 20.3 or later.

<Steps>
<Steps.Step>

**Get an API key**

In Platica, open **Settings → API Keys** and create a key. It is shown once: copy it and store it in an environment variable. Follow [API keys](/help/settings/api-keys) if you need help. The key works only in the workspace where you created it; see [Authentication](/authentication).

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
export PLATIC_API_KEY="pl_key_xxxxxxxxxxxxx"
```

</Ways.Way>
<Ways.Way name="sdk">

```bash
export PLATIC_API_KEY="pl_key_xxxxxxxxxxxxx"
npm install platic-sdk
```

</Ways.Way>
</Ways>

</Steps.Step>
<Steps.Step>

**Create an agent**

Give the agent a name and instructions for its replies. It is created published and can answer right away. See [Create an agent](/api-reference/agents/create).

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/agents \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sales",
    "instructions": "You are the sales assistant for Acme. Answer kindly and briefly."
  }'
```

The response has the agent's `id` in `data.id`. Save it:

```bash
export AGENT_ID="paste-the-id-here"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
import { Platic } from "platic-sdk";

const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! });

const agent = await platic.agents.create({
  name: "Sales",
  instructions: "You are the sales assistant for Acme. Answer kindly and briefly.",
});

console.log(agent.id);
```

</Ways.Way>
</Ways>

</Steps.Step>
<Steps.Step>

**Chat with it**

Send a message to the agent. The agent's answer comes back in the same call. See [Send a message to the agent](/api-reference/chat/send).

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/chat \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "'$AGENT_ID'",
    "message": "Which plan fits a team of 25?",
    "client": { "id": "customer_123", "name": "Ana" }
  }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
const turn = await platic.chat.send({
  agentId: agent.id,
  message: "Which plan fits a team of 25?",
  client: { id: "customer_123", name: "Ana" },
});

for (const reply of turn.messages) console.log(reply.content);
```

</Ways.Way>
</Ways>

To continue the conversation, include the response's `conversationId` in your next message. If you omit it, a new conversation is created.

</Steps.Step>
</Steps>

## It worked if...

- Step 2 gives you the new agent's `id`. The REST API response also includes `"status": "success"`; the SDK returns the agent directly.
- Step 3 returns `messages` with at least one `assistant` message, which is the agent's answer.
If you receive `401`, check `PLATIC_API_KEY`: the key is wrong or missing.

The conversation also appears in the Platica inbox, where your team can read it.

<Note type="tip">

Each chat turn uses workspace credits. When you finish, you can [delete the test agent](/api-reference/agents/delete).

</Note>

## Next steps

- [Create your first agent](/guides/create-an-agent): edit its instructions in a draft and publish.
- [Add knowledge](/guides/add-knowledge) so it knows your business.
- [Chat API](/guides/chat-api): follow conversations and read history.
- [Connect a channel](/guides/connect-a-channel) so it answers your customers.
- Read the [core concepts](/concepts), and [Responses](/api-reference/responses) before you write your integration.
