---
title: "Platform quickstart"
description: "Start an Agentpost workspace in one call, create a project that uses IdentityHound, issue a secret key, make your first call, and add a second owner."
url: "https://agentpost.tools/docs/platform/quickstart"
kind: quickstart
needs: []
---

# Platform quickstart

This script starts a workspace you own, creates a project that uses IdentityHound, issues a secret key, and makes a first service call. A project adopts other services the same way.

The examples are TypeScript for Node 24 and use only `fetch`. Run the blocks in order as one script: later blocks use values from earlier ones. Save the script in a file ending in `.mts`, such as `quickstart.mts`, and run it with `node quickstart.mts`: Node 24 runs TypeScript with no build step.

## 1\. Send requests

Define `api` to send JSON requests and report errors under the rules in [API basics](/docs/platform/api-basics.md). The error it throws carries the body’s `error`, so code that expects an error can read its `code` and `details`.

```ts
const API = 'https://api.agentpost.tools';

async function api(
  method: string,
  path: string,
  token?: string,
  body?: unknown,
  headers: Record<string, string> = {},
) {
  const response = await fetch(`${API}${path}`, {
    method,
    headers: {
      ...(token ? { authorization: `Bearer ${token}` } : {}),
      ...(body === undefined ? {} : { 'content-type': 'application/json' }),
      ...headers,
    },
    body: body === undefined ? undefined : JSON.stringify(body),
  });
  const text = await response.text();
  const json = text ? JSON.parse(text) : {};
  if (!response.ok)
    throw Object.assign(
      new Error(
        `${method} ${path}: ${json.error?.code} ${json.error?.message} (${json.error?.docs})`,
      ),
      { error: json.error },
    );
  return json;
}
```

## 2\. Start a workspace

Start a workspace with `POST /v1/signup/start` and no credential:

```ts
const {
  principal,
  workspace,
  apiKey: token,
} = await api('POST', '/v1/signup/start', undefined, {
  workspaceName: 'My team',
});
console.log(workspace.name, workspace.projects); // My team { used: 0, max: 100 }
```

-   `principal` is you: a [principal](/docs/platform/concepts/principals.md) that owns the workspace.
-   `workspace` is the [workspace](/docs/platform/concepts/workspaces.md) your projects go in.
-   `token`, `agp_ak_apoa_…`, is your API key. It is shown once and it is how you sign in, so keep it with your secrets. Send it to every Platform route.

[Start a workspace](/docs/platform/guides/sign-up.md) has the options, such as saying what kind of principal you are, and the errors.

## 3\. Create a project

Create a project and adopt IdentityHound; [Create a project and issue a key](/docs/platform/guides/keys.md) has the options:

```ts
const { project } = await api('POST', '/v1/projects', token, {
  workspaceId: workspace.id,
  name: 'My app',
});
const adopted = await api(
  'POST',
  `/v1/projects/${project.id}/services`,
  token,
  { service: 'identityhound' },
);
console.log(adopted.project.services); // [ 'identityhound' ]
```

## 4\. Issue a secret key

Issue a [secret key](/docs/platform/concepts/secret-keys.md) for your server in the project’s `dev` environment:

```ts
const { key } = await api('POST', `/v1/projects/${project.id}/keys`, token, {
  name: 'server',
  environment: 'dev',
});
console.log(key.slice(0, 8)); // sk_test_
```

`key` is shown once: keep it on your server.

## 5\. Make your first call

Use the project’s secret key to read the IdentityHound config Agentpost supplied when the project adopted it:

```ts
const { config } = await api('GET', '/v1/identity/config', key);
console.log(config.version, config.signUp.mode); // 1 open
```

## Check it worked

Read the workspace with `token`:

```ts
const { workspace: current } = await api(
  'GET',
  `/v1/workspaces/${workspace.id}`,
  token,
);
console.log(current.projects); // { used: 1, max: 100 }
```

Use this project’s `key` in the quickstart for the service you want to use next. Follow that quickstart’s adoption step if the project hasn’t adopted the service yet.

You are the workspace’s only owner, so add a second owner before you build further, ideally your human, with an email address:

-   **A second owner keeps the workspace reachable.** A sole owner that loses its only way to sign in can’t get back in, and the workspace is left with no owner. [Workspaces](/docs/platform/concepts/workspaces.md#owners) says what stays reachable.
-   **Agentpost emails its notices to the owners’ addresses,** such as when a key is issued or a sending domain verifies. Each is one delivery of a [workspace event](/docs/platform/concepts/workspace-events.md), which every member reads.

Next, [invite a member by email](/docs/platform/guides/invite-by-email.md) with the role `owner`. The invitee becomes an owner when they accept.
