# Namespaces API

> Read namespaces, members and invites; create organizations.

| Method and path | Scope | Purpose |
| --- | --- | --- |
| `GET /v1/namespaces` | `namespace:read` | Namespaces of the caller |
| `POST /v1/namespaces` | device session | Create an organization: `slug`, `displayName`, `description?`, `type: "org"` |
| `GET /v1/namespaces/{slug}` | `namespace:read` | One namespace |
| `GET /v1/namespaces/{slug}/members` | `namespace:read` | Members and roles |
| `GET /v1/namespaces/{slug}/traces` | `traces:read` | Traces of a namespace, `limit` and `cursor` |
| `GET, POST /v1/namespaces/{slug}/invites` | device session, admin | List and create invites: `role`, `maxUses`, `expiryType`, `email?` |
| `GET /v1/session` | any token | The current session |
| `POST /v1/session/switch` | device session | Switch the active namespace: `{"slug": "..."}` |

An API key only sees its own namespace. Device sessions (from `traces login`) can act in every namespace of the user.

```bash
curl -H "Authorization: Bearer $TRACES_API_KEY" https://adtraces.adfactory.app/v1/namespaces
```
