# Sign Up

`POST /gate/signup` · Identity & Access · Sign-in & Sessions

Creates a new end-user account on the project using email and password credentials. On success, an `eu_`-prefixed end-user record is created and a project-scoped Gate JWT plus refresh token are returned. This endpoint is app-layer-unauthenticated (reachable before any end-user JWT exists); the Free tier enforces a 50,000 MAU cap at the gateway.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `email` | string (email) | yes | The new end user's email address. It is stored in lower case and must not already be registered in this project. |
| `password` | string | yes | The new password, at least 12 characters. A password found in known data breaches is refused. |
| `displayName` | string | no | A display name, 1 to 128 characters. It is validated but not stored. |

```json
{
  "email": "jane@demo.example",
  "password": "correct-horse-battery-staple"
}
```

## Responses

- **201**: Created

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | The new end user, already signed in. |
| `data.user` | object | yes | The end user. |
| `data.user.id` | string | yes | The end user's id (`eu_...`). |
| `data.user.email` | string | yes | The end user's email address. An address given at sign-up is stored in lower case. |
| `data.user.status` | enum ("active", "locked", "deleted") | yes | The account's status. A successful response always carries `active`: a locked or deleted account cannot sign in. |
| `data.user.createdAt` | string (date-time) | yes | When the end user signed up. |
| `data.user.updatedAt` | object | yes | When the account record last changed, or null if it never has. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.user.lastSigninAt` | object | yes | When the end user last signed in with a password, or null if they never have (for example straight after sign-up). |
| _one of_ | | |  |
| _or_ | | |  |
| `data.user.roles` | array of string | yes | The end user's platform role. Always `["PROJECT_END_USER"]`. Roles you grant through end-user role grants are not listed here. |
| `data.user.groups` | array of string | yes | Always an empty array in this response. The end user's group names are carried in the access token's `groups` claim. |
| `data.session` | object | yes | The tokens for the new session. Keep the refresh token for `POST /@{projectSlug}/gate/refresh` and send the access token on API calls. |
| `data.session.accessToken` | string | yes | A signed JWT that authenticates the end user to this project's API. Send it as `Authorization: Bearer <accessToken>`. Its subject (`sub`) is the end user's id (`eu_...`), its audience (`aud`) is the project id (`proj_...`), and its issuer is the API origin of the region that holds the end user. It lives for the project's end-user access token lifetime: 30 minutes by default, settable from 5 to 60 minutes. `expiresAt` is when it expires. It cannot be revoked early: signing out or revoking sessions stops the next refresh, but a token already issued stays valid until `expiresAt`. |
| `data.session.refreshToken` | string | yes | An opaque secret (43 base64url characters) that gets a new access token from `POST /@{projectSlug}/gate/refresh`. Store it securely and never send it anywhere else. It is single use: every refresh returns a new refresh token, and sending the one it replaced a second time ends the whole session. It stops working when the session ends: on sign-out, a password reset, a revoke-all, or when the project's session limits are reached (by default 30 days without a refresh, or 90 days after sign-in, whichever comes first). |
| `data.session.expiresAt` | string (date-time) | yes | When `accessToken` expires. Refresh before this time to keep the end user signed in. |
| `meta` | object | yes | Request metadata: cost, timing and the request and trace ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 400 | `K9O_INVALID_REQUEST_SHAPE` | The supplied password is shorter than the minimum length required by the request schema. |
| 409 | `K9O_EMAIL_ALREADY_REGISTERED` | An account with this email address already exists. |
| 502 | `K9O_IDP_FEDERATION_FAILED` | Federated sign-up via the configured identity provider failed during the provisioning flow. |
| 400 | `K9O_PASSWORD_COMPROMISED` | The new password appears in a known data breach at or above the project's threshold (the project's have-i-been-pwned install, with its Gate block on). Choose a different password; context is empty. |

## Code samples

### cURL

```bash
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/gate/signup' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "jane@demo.example",
  "password": "correct-horse-battery-staple"
}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/gate/signup', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "email": "jane@demo.example",
  "password": "correct-horse-battery-staple"
}),
});
const { data, meta } = await res.json();
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.gate.signUp({
  email: 'jane@demo.example',
  password: 'correct-horse-battery-staple'
})
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.gate.sign_up({
    "email": "jane@demo.example",
    "password": "correct-horse-battery-staple"
})
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Gate.SignUp(ctx, map[string]any{"email": "jane@demo.example", "password": "correct-horse-battery-staple"})
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.gate.sign_up(json!({"email": "jane@demo.example", "password": "correct-horse-battery-staple"})).await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.gate().signUp(Map.of("email", "jane@demo.example", "password", "correct-horse-battery-staple"))
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Gate.SignUpAsync(new Dictionary<string, object> { ["email"] = "jane@demo.example", ["password"] = "correct-horse-battery-staple" })
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.gate.sign_up({ email: "jane@demo.example", password: "correct-horse-battery-staple" })
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->gate->sign_up(['email' => 'jane@demo.example', 'password' => 'correct-horse-battery-staple'])
```

### K9o

```swift
// let k9o = try K9o.createClient(orgSlug: "playground", projectSlug: "storefront", apiKey: "k9o_…")
let result = try await k9o.gate.signUp({
  email: "jane@demo.example",
  password: "correct-horse-battery-staple"
})
```

### core-kotlin

```kotlin
// val k9o = createClient { orgSlug = "playground"; projectSlug = "storefront"; apiKey = "k9o_…" }
val result = k9o.gate.signUp({
  email: "jane@demo.example",
  password: "correct-horse-battery-staple"
})
```

### k9o (Flutter)

```dart
// final k9o = K9o.createClient(orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…');
final result = await k9o.gate.signUp({
  email: 'jane@demo.example',
  password: 'correct-horse-battery-staple'
})
```

### @k9o/react-native

```javascript
// const k9o = createClient({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })  // RN, secure storage
const { data } = await k9o.gate.signUp({
  email: 'jane@demo.example',
  password: 'correct-horse-battery-staple'
})
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/identity-access/sign-up
