Organizations#

Organization management

Check organization slug availability#

GET/organizations/check-slug

Check if an organization slug is available and get suggestions if not

Parameters#

NameTypeLocationRequiredDescription
slugstringqueryYesThe slug to check

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/organizations/check-slug?slug=value" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "available": false,
  "slug": "my-company",
  "suggestions": [
    "my-company-2",
    "my-company-inc",
    "my-company-io"
  ],
  "error": "Slug must match pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$"
}

List organizations#

GET/organizations

List organizations where user is a member

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
offsetintegerqueryNoNumber of items to skip
limitintegerqueryNoMaximum number of items to return

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/organizations?offset=value&limit=value" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Acme Corp",
      "slug": "acme-corp",
      "owner_id": "550e8400-e29b-41d4-a716-446655440000",
      "billing_email": "billing@acme.com",
      "status": "active",
      "created_at": "2025-10-02T15:30:00Z",
      "updated_at": "2025-10-02T15:30:00Z",
      "settings": {}
    }
  ],
  "meta": {
    "offset": 0,
    "limit": 1,
    "total": 0
  }
}

Create organization#

POST/organizations

Create new organization (user becomes owner)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Request Body#

Example:

{
    "name": "string",
    "slug": "string",
    "billing_email": "user@example.com",
    "settings": {}
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/organizations" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "name": "string",
    "slug": "string",
    "billing_email": "user@example.com",
    "settings": {}
}'

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Acme Corp",
  "slug": "acme-corp",
  "owner_id": "550e8400-e29b-41d4-a716-446655440000",
  "billing_email": "billing@acme.com",
  "status": "active",
  "created_at": "2025-10-02T15:30:00Z",
  "updated_at": "2025-10-02T15:30:00Z",
  "settings": {}
}

Get organization#

GET/organizations/{org_id}

Get organization details

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/organizations/{org_id}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Acme Corp",
  "slug": "acme-corp",
  "owner_id": "550e8400-e29b-41d4-a716-446655440000",
  "billing_email": "billing@acme.com",
  "status": "active",
  "created_at": "2025-10-02T15:30:00Z",
  "updated_at": "2025-10-02T15:30:00Z",
  "settings": {}
}

Update organization#

PATCH/organizations/{org_id}

Update organization (requires admin+ role)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Request Body#

Example:

{
    "name": "string",
    "billing_email": "user@example.com",
    "settings": {}
}

Code Examples#

curl -X PATCH "https://searchaf.antfly.io/api/v1/organizations/{org_id}" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "name": "string",
    "billing_email": "user@example.com",
    "settings": {}
}'

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Acme Corp",
  "slug": "acme-corp",
  "owner_id": "550e8400-e29b-41d4-a716-446655440000",
  "billing_email": "billing@acme.com",
  "status": "active",
  "created_at": "2025-10-02T15:30:00Z",
  "updated_at": "2025-10-02T15:30:00Z",
  "settings": {}
}

Delete organization#

DELETE/organizations/{org_id}

Delete organization (requires owner role, cascades to projects)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Code Examples#

curl -X DELETE "https://searchaf.antfly.io/api/v1/organizations/{org_id}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

No response body

List organization members#

GET/organizations/{org_id}/members

List all members of organization

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
offsetintegerqueryNoNumber of items to skip
limitintegerqueryNoMaximum number of items to return

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/organizations/{org_id}/members?offset=value&limit=value" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "user_id": "550e8400-e29b-41d4-a716-446655440000",
      "organization_id": "550e8400-e29b-41d4-a716-446655440000",
      "role": "owner",
      "invited_by": "550e8400-e29b-41d4-a716-446655440000",
      "invited_at": "2025-10-02T15:30:00Z",
      "joined_at": "2025-10-02T15:30:00Z",
      "status": "invited",
      "user": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "email": "user@example.com",
        "display_name": "John Doe",
        "avatar_url": "https://example.com/avatar.jpg",
        "created_at": "2025-10-02T15:30:00Z",
        "updated_at": "2025-10-02T15:30:00Z",
        "last_login_at": "2025-10-02T15:30:00Z",
        "status": "active",
        "settings": {}
      }
    }
  ],
  "meta": {
    "offset": 0,
    "limit": 1,
    "total": 0
  }
}

Invite member#

POST/organizations/{org_id}/members

Invite user to organization (requires admin+ role)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Request Body#

Example:

{
    "email": "user@example.com",
    "role": "owner"
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/organizations/{org_id}/members" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "email": "user@example.com",
    "role": "owner"
}'

Responses#

{
  "invitation_id": "550e8400-e29b-41d4-a716-446655440000",
  "email": "user@example.com",
  "role": "owner",
  "expires_at": "2025-10-02T15:30:00Z",
  "status": "invited",
  "token": "string"
}

Update member role#

PATCH/organizations/{org_id}/members/{member_id}

Update organization member role (requires admin+ role, cannot change owner)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
member_idstringpathYesMember ID

Request Body#

Example:

{
    "role": "admin"
}

Code Examples#

curl -X PATCH "https://searchaf.antfly.io/api/v1/organizations/{org_id}/members/{member_id}" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "role": "admin"
}'

Responses#

{
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "role": "string",
  "updated_at": "2025-10-02T15:30:00Z"
}

Remove member#

DELETE/organizations/{org_id}/members/{member_id}

Remove user from organization (requires admin+ role)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
member_idstringpathYesMember ID

Code Examples#

curl -X DELETE "https://searchaf.antfly.io/api/v1/organizations/{org_id}/members/{member_id}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

No response body

Transfer organization ownership#

POST/organizations/{org_id}/transfer-ownership

Transfer organization ownership to another admin (requires owner role + password confirmation or OAuth re-authentication)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Request Body#

Example:

{
    "new_owner_id": "550e8400-e29b-41d4-a716-446655440000",
    "password": "string",
    "reauth_verified": true
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/organizations/{org_id}/transfer-ownership" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "new_owner_id": "550e8400-e29b-41d4-a716-446655440000",
    "password": "string",
    "reauth_verified": true
}'

Responses#

{
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "old_owner_id": "550e8400-e29b-41d4-a716-446655440000",
  "new_owner_id": "550e8400-e29b-41d4-a716-446655440000",
  "transferred_at": "2025-10-02T15:30:00Z"
}

Get invitation details#

GET/invitations/{token}

Retrieve invitation details by token (public endpoint)

Parameters#

NameTypeLocationRequiredDescription
tokenstringpathYesInvitation token

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/invitations/{token}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "invitation_id": "550e8400-e29b-41d4-a716-446655440000",
  "email": "user@example.com",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_name": "string",
  "project_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_name": "string",
  "role": "string",
  "expires_at": "2025-10-02T15:30:00Z"
}

Revoke invitation#

DELETE/invitations/{token}

Revoke an invitation token (requires authentication - only inviter or org admin/owner can revoke)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
tokenstringpathYesInvitation token

Code Examples#

curl -X DELETE "https://searchaf.antfly.io/api/v1/invitations/{token}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

No response body

Accept invitation#

POST/invitations/{token}/accept

Accept an invitation token and create membership (requires authenticated user)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
tokenstringpathYesInvitation token

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/invitations/{token}/accept" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "550e8400-e29b-41d4-a716-446655440000",
  "role": "string",
  "joined_at": "2025-10-02T15:30:00Z"
}

Resend invitation#

POST/invitations/{token}/resend

Resend invitation email with a new token (requires authentication - only inviter or org admin/owner can resend)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
tokenstringpathYesOriginal invitation token

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/invitations/{token}/resend" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "message": "Invitation email resent successfully",
  "new_token": "string",
  "expires_at": "2025-10-02T15:30:00Z"
}

Sign up and accept invitation#

POST/invitations/{token}/signup-and-accept

Create new account and accept invitation in one step (skips email verification by trusting invitation token)

Parameters#

NameTypeLocationRequiredDescription
tokenstringpathYesInvitation token

Request Body#

Example:

{
    "display_name": "string",
    "password": "string"
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/invitations/{token}/signup-and-accept" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "display_name": "string",
    "password": "string"
}'

Responses#

{
  "access_token": "string",
  "refresh_token": "string",
  "user": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "user@example.com",
    "display_name": "John Doe",
    "avatar_url": "https://example.com/avatar.jpg",
    "created_at": "2025-10-02T15:30:00Z",
    "updated_at": "2025-10-02T15:30:00Z",
    "last_login_at": "2025-10-02T15:30:00Z",
    "status": "active",
    "settings": {}
  },
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "550e8400-e29b-41d4-a716-446655440000"
}

List organization provider configurations#

GET/organizations/{org_id}/providers

List all AI provider configurations for an organization

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/organizations/{org_id}/providers" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "organization_id": "550e8400-e29b-41d4-a716-446655440000",
      "provider": "gemini",
      "enabled": true,
      "has_api_key": true,
      "config": {},
      "created_at": "2025-10-02T15:30:00Z",
      "updated_at": "2025-10-02T15:30:00Z"
    }
  ]
}

Create organization provider configuration#

POST/organizations/{org_id}/providers

Configure an AI provider for the organization (requires owner or admin role)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Request Body#

Example:

{
    "provider": "gemini",
    "api_key": "AIzaSy...",
    "config": {},
    "enabled": true
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/organizations/{org_id}/providers" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "provider": "gemini",
    "api_key": "AIzaSy...",
    "config": {},
    "enabled": true
}'

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "provider": "gemini",
  "enabled": true,
  "has_api_key": true,
  "config": {},
  "created_at": "2025-10-02T15:30:00Z",
  "updated_at": "2025-10-02T15:30:00Z"
}

Get organization provider configuration#

GET/organizations/{org_id}/providers/{provider}

Get a specific AI provider configuration for an organization

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
providerstring (gemini, openai, anthropic)pathYesAI provider type (gemini, openai, anthropic, vertex, bedrock)

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/organizations/{org_id}/providers/{provider}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "provider": "gemini",
  "enabled": true,
  "has_api_key": true,
  "config": {},
  "created_at": "2025-10-02T15:30:00Z",
  "updated_at": "2025-10-02T15:30:00Z"
}

Update organization provider configuration#

PATCH/organizations/{org_id}/providers/{provider}

Update an AI provider configuration (requires owner or admin role)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
providerstring (gemini, openai, anthropic)pathYesAI provider type (gemini, openai, anthropic, vertex, bedrock)

Request Body#

Example:

{
    "api_key": "string",
    "config": {},
    "enabled": true
}

Code Examples#

curl -X PATCH "https://searchaf.antfly.io/api/v1/organizations/{org_id}/providers/{provider}" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "api_key": "string",
    "config": {},
    "enabled": true
}'

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "provider": "gemini",
  "enabled": true,
  "has_api_key": true,
  "config": {},
  "created_at": "2025-10-02T15:30:00Z",
  "updated_at": "2025-10-02T15:30:00Z"
}

Delete organization provider configuration#

DELETE/organizations/{org_id}/providers/{provider}

Remove an AI provider configuration (requires owner or admin role)

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
providerstring (gemini, openai, anthropic)pathYesAI provider type (gemini, openai, anthropic, vertex, bedrock)

Code Examples#

curl -X DELETE "https://searchaf.antfly.io/api/v1/organizations/{org_id}/providers/{provider}" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

No response body