Athena

Auth Organization

Top-level organization operations and permission checks.

Top-level organization operations are documented here. Invitation and member sub-surfaces are split into:

Endpoints and Methods

  • auth.organization.create() -> POST /organization/create
  • auth.organization.update() -> POST /organization/update
  • auth.organization.delete() -> POST /organization/delete
  • auth.organization.setActive() -> POST /organization/set-active
  • auth.organization.list() -> GET /organization/list
  • auth.organization.getFull() -> GET /organization/get-full-organization
  • auth.organization.checkSlug() -> POST /organization/check-slug
  • auth.organization.leave() -> POST /organization/leave
  • auth.organization.listUserInvitations() -> GET /organization/list-user-invitations
  • auth.organization.hasPermission() -> POST /organization/has-permission

Examples

ATHENA_AUTH_BASE_URL="http://localhost:3001/api/auth"
ATHENA_AUTH_TOKEN="<bearer-token>"

# Adjust payload fields using the OpenAPI schema in this page.

# auth.organization.create() -> POST /organization/create
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/create" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.organization.update() -> POST /organization/update
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/update" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.organization.delete() -> POST /organization/delete
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/delete" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.organization.setActive() -> POST /organization/set-active
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/set-active" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.organization.list() -> GET /organization/list
curl -X GET "$ATHENA_AUTH_BASE_URL/organization/list" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.organization.getFull() -> GET /organization/get-full-organization
curl -X GET "$ATHENA_AUTH_BASE_URL/organization/get-full-organization" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.organization.checkSlug() -> POST /organization/check-slug
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/check-slug" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.organization.leave() -> POST /organization/leave
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/leave" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.organization.listUserInvitations() -> GET /organization/list-user-invitations
curl -X GET "$ATHENA_AUTH_BASE_URL/organization/list-user-invitations" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.organization.hasPermission() -> POST /organization/has-permission
curl -X POST "$ATHENA_AUTH_BASE_URL/organization/has-permission" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'
use reqwest::Client;
use serde_json::json;

let base_url = "http://localhost:3001/api/auth";
let token = "<bearer-token>";
let http = Client::new();

// Adjust payload fields using the OpenAPI schema in this page.

// auth.organization.create() -> POST /organization/create
let response = http
    .post(format!("{base_url}/organization/create"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.update() -> POST /organization/update
let response = http
    .post(format!("{base_url}/organization/update"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.delete() -> POST /organization/delete
let response = http
    .post(format!("{base_url}/organization/delete"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.setActive() -> POST /organization/set-active
let response = http
    .post(format!("{base_url}/organization/set-active"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.list() -> GET /organization/list
let response = http
    .get(format!("{base_url}/organization/list"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.getFull() -> GET /organization/get-full-organization
let response = http
    .get(format!("{base_url}/organization/get-full-organization"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.checkSlug() -> POST /organization/check-slug
let response = http
    .post(format!("{base_url}/organization/check-slug"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.leave() -> POST /organization/leave
let response = http
    .post(format!("{base_url}/organization/leave"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.listUserInvitations() -> GET /organization/list-user-invitations
let response = http
    .get(format!("{base_url}/organization/list-user-invitations"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.organization.hasPermission() -> POST /organization/has-permission
let response = http
    .post(format!("{base_url}/organization/has-permission"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;
import { client } from "./auth-client"

await client.auth.organization.create({
  name: "Acme",
  slug: "acme",
})

await client.auth.organization.update({
  organizationId: "org_1",
  data: { name: "Acme Updated" },
})

await client.auth.organization.delete({
  organizationId: "org_1",
})

await client.auth.organization.setActive({
  organizationId: "org_1",
})

await client.auth.organization.list()

await client.auth.organization.getFull({
  query: { organizationId: "org_1" },
})

await client.auth.organization.checkSlug({
  slug: "acme",
})

await client.auth.organization.leave({
  organizationId: "org_1",
})

await client.auth.organization.listUserInvitations()

await client.auth.organization.hasPermission({
  permissions: { project: ["create"] },
})

OpenAPI Contract

POST
/organization/create

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

name*string

The name of the organization

slug*string

The slug of the organization

userId?string

The user id of the organization creator. If not provided, the current user will be used. Should only be used by admins or when called by the server.

logo?string

The logo of the organization

metadata?string

The metadata of the organization

keepCurrentActiveOrganization?string

Whether to keep the current active organization active after creating a new one

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/create" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "slug": "string"  }'
{
  "id": "string",
  "name": "string",
  "slug": "string",
  "logo": "string",
  "createdAt": null,
  "metadata": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/organization/update

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

data*object
organizationId?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/update" \  -H "Content-Type: application/json" \  -d '{    "data": {}  }'
{
  "id": "string",
  "name": "string",
  "slug": "string",
  "logo": "string",
  "createdAt": null,
  "metadata": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/organization/delete

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

organizationId*string

The organization id to delete

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/delete" \  -H "Content-Type: application/json" \  -d '{    "organizationId": "string"  }'
"string"
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/organization/set-active

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

organizationId?string

The organization id to set as active. It can be null to unset the active organization

organizationSlug?string

The organization slug to set as active. It can be null to unset the active organization if organizationId is not provided

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/set-active" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "string",
  "name": "string",
  "slug": "string",
  "logo": "string",
  "createdAt": null,
  "metadata": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/organization/list

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3001/api/auth/organization/list"
[
  {
    "id": "string",
    "name": "string",
    "slug": "string",
    "logo": "string",
    "createdAt": null,
    "metadata": "string"
  }
]
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/organization/get-full-organization

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3001/api/auth/organization/get-full-organization"
{
  "id": "string",
  "name": "string",
  "slug": "string",
  "logo": "string",
  "createdAt": null,
  "metadata": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/organization/check-slug

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

slug*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/check-slug" \  -H "Content-Type: application/json" \  -d '{    "slug": "string"  }'
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/organization/leave

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

organizationId*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/leave" \  -H "Content-Type: application/json" \  -d '{    "organizationId": "string"  }'
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/organization/list-user-invitations

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

application/json

curl -X GET "http://localhost:3001/api/auth/organization/list-user-invitations"
[
  {}
]
POST
/organization/has-permission

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

permission?objectDeprecated

The permission to check

permissions*object

The permission to check

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/organization/has-permission" \  -H "Content-Type: application/json" \  -d '{    "permissions": {}  }'
{
  "error": "string",
  "success": true
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}