# Quickstart

From an empty project to a signed-in user reading and writing rows that only their organization can see. Everything here uses `curl`, so it translates directly to any language.

You need a project and its publishable key. See [Your first project](https://rezincore.com/docs/getting-started/first-project.md).

```
export API=https://api.rezincore.com
export KEY=rzc_pub_your_publishable_key
```

## 1. Make a table

In the console open the project, then **Data → Tables page → New table**. Name it `notes` and give it these columns:

| Column | Type | Default | Notes |
|---|---|---|---|
| `id` | ID | Random ID | Primary key |
| `organization_id` | ID | Current organization | Which organization the row belongs to |
| `owner_id` | ID | Current person | Who wrote it |
| `title` | Text | | |
| `pinned` | True or false | False | |
| `created_at` | Date and time | Now | |

The table starts **closed**: row-level security is on and there is no rule, so the application is given no rows. That is deliberate.

## 2. Open it with a policy

Open the project's **Security → Access rules** page and find `notes`.

1. Under **The application may**, allow reading, adding, changing and deleting rows.
2. Choose **Add or edit a policy** and pick the template "only rows of the caller's organization". It writes:

```
for everything
using       organization_id = core.app_org()
with check  organization_id = core.app_org()
```

Now a signed-in user gets the rows of their own organization and no others. [Row-level security and policies](https://rezincore.com/docs/database/row-level-security.md) explains the rule and the alternatives.

## 3. Let people sign up

Open **Authentication → Sign-in methods** and switch on self sign-up. New accounts join the organization the project names; a new project already names its first organization.

## 4. Create an account and sign in

```
curl -s $API/v1/auth/signup -H "apikey: $KEY" -H "content-type: application/json" \
  -d '{"email":"sam@example.test","password":"a long passphrase here","fullName":"Sam Rivera"}'
```

```json
{ "id": "5b0c1d8e-3f7a-4c2b-9e1d-6a7b8c9d0e1f" }
```

```
curl -s $API/v1/auth/signin -H "apikey: $KEY" -H "content-type: application/json" \
  -d '{"email":"sam@example.test","password":"a long passphrase here"}'
```

```json
{
  "token": "…",
  "userId": "5b0c1d8e-3f7a-4c2b-9e1d-6a7b8c9d0e1f",
  "organizationId": "0d9c8b7a-6f5e-4d3c-8b2a-1f0e9d8c7b6a",
  "mustChangePassword": false,
  "idleMinutes": 15
}
```

Keep the token. Send it as `Authorization: Bearer <token>` on every request after this.

```
export TOKEN=the_token_from_the_answer
```

## 5. Add a row

```
curl -s $API/v1/data/notes -H "apikey: $KEY" -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" -d '{"title":"Hello"}'
```

```json
{ "rows": [ { "id": "…", "organization_id": "0d9c8b7a-…", "owner_id": "5b0c1d8e-…", "title": "Hello", "pinned": false, "created_at": "2026-11-26T15:04:05.000Z" } ] }
```

You did not send `organization_id`: the API fills it in with the caller's organization, and the policy would refuse any other value.

## 6. Read, change, delete

```
# read, newest first
curl -s "$API/v1/data/notes?order=created_at.desc&limit=20" -H "apikey: $KEY" -H "authorization: Bearer $TOKEN"

# change one row
curl -s -X PATCH "$API/v1/data/notes?id=eq.$ID" -H "apikey: $KEY" -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" -d '{"pinned":true}'

# delete it
curl -s -X DELETE "$API/v1/data/notes?id=eq.$ID" -H "apikey: $KEY" -H "authorization: Bearer $TOKEN"
```

Changing and deleting always need a filter.

## 7. Check what a user really gets

On the **Security → Access rules** page use **View as**: pick `notes` and a user. The console fetches the table exactly as the application would for that person and shows how many rows they are given. If two users in two organizations each see only their own rows there, they will through the API too.

## Calling the API from a browser

A web page may call the API only from an address the project lists. Set the **Site URL** (and any **Redirect URLs**) under **Authentication → URL configuration**. See [Authentication settings](https://rezincore.com/docs/auth/settings.md).

## Where next

- [The data API](https://rezincore.com/docs/database/data-api.md): every filter and option.
- [Accounts for your users](https://rezincore.com/docs/auth/overview.md): sessions, sign-out, the authenticator step.
- [Storage](https://rezincore.com/docs/storage.md), [Realtime](https://rezincore.com/docs/realtime.md), [Webhooks](https://rezincore.com/docs/webhooks.md).
- [The command-line tool](https://rezincore.com/docs/tools/cli.md) for migrations kept in your repository.
