API Reference: Users & Organizations Managing Admin Tasks and Subscriptions

Manage your organization's users, verify subscription features, and handle support requests using the GitDocAI API. This guide covers the endpoints available for administrative and operational tasks.

All endpoints require authentication. Ensure you include your bearer token in the Authorization header of your requests.

Managing Organization Users

As an organization administrator, you can invite new members, manage their roles, and configure their access grants.

ActionMethodEndpointDescription
Invite userPOST/v1/organization/{organization_id}/user/inviteSends an invitation to join the organization.
Get pending invitesGET/v1/organization/{organization_id}/user/pendingLists all invitations that have not yet been accepted.
Update rolePATCH/v1/organization/{organization_id}/user/{user_id}/roleChanges a user's role (e.g., from member to admin).
Manage grantsPATCH/v1/organization/{organization_id}/users/{user_id}/grantsAdds or removes specific document grants (currently restricted to readers).
Remove userDELETE/v1/organization/{organization_id}/user/{user_id}Revokes a user's access to the organization entirely.

Example: Inviting a new user

curl -X POST https://api.gitdocai.com/v1/organization/org_12345/user/invite 
  -H "Authorization: Bearer YOUR_API_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"email": "newuser@example.com", "role": "member"}'

User Preferences

You can also retrieve user-specific settings across the platform.

ActionMethodEndpointDescription
Get preferencesGET/preferencesList all user preferences.

Validating Subscriptions

Before granting a user access to a premium feature or allowing them to perform an action that consumes quota, you should validate their organization's subscription status.

sequenceDiagram
    participant App as Your Application
    participant API as GitDocAI API
    
    App->>API: GET /subscription/validate-feature
    API-->>App: { "enabled": true }
    
    App->>API: GET /subscription/validate-limit
    alt Limit not reached
        API-->>App: { "allowed": true }
        App->>App: Execute Feature
    else Limit reached
        API-->>App: { "allowed": false }
        App->>App: Show Upgrade Prompt
    end
ActionMethodEndpoint
Get feature valueGET/organization/{organization_id}/subscription/feature-value
Validate featureGET/organization/{organization_id}/subscription/validate-feature
Validate limitGET/organization/{organization_id}/subscription/validate-limit

Always use validate-limit before executing heavy operations (like bulk exports or AI generations) to ensure the organization has sufficient quota remaining for the current billing cycle.

Internal Subscription Toggles (S2S)

For server-to-server integrations, you can directly toggle the active status of an organization's documentations.

ActionMethodEndpointDescription
Toggle active statusPOST/internal/subscriptions/{organization_id}/toggle-activeToggle documentations active for an org (S2S).

Managing Support Tickets

If your users encounter issues, you can programmatically create and manage support tickets on their behalf.

  1. 1

    Create a ticket

    Use POST /organization/{organization_id}/support/tickets to open a new support request. You will receive a ticket_id in the response.

  2. 2

    Add details or messages

    If the user provides more context, append it to the open ticket using POST /organization/{organization_id}/support/tickets/{ticket_id}/messages.

  3. 3

    Check ticket status

    Poll or retrieve the latest updates on the ticket using GET /organization/{organization_id}/support/tickets/{ticket_id}.

To view all historical and active tickets for an organization, use the GET /organization/{organization_id}/support/tickets endpoint.

Global Customer Administration

The following endpoints are restricted to Global System Administrators. Standard organization API keys will receive a 403 Forbidden response if they attempt to access these routes.

These endpoints are designed for internal dashboards and reporting tools to oversee all customers on the platform.

ActionMethodEndpointDescription
List customersGET/v1/admin/customersRetrieves a paginated list of all registered organizations.
Export customersGET/v1/admin/customers/exportGenerates a CSV file containing customer metadata and subscription statuses.
Customer overviewGET/v1/admin/customers/{organization_id}Retrieves a comprehensive administrative overview of a specific customer.
Why am I getting a 403 error on the export endpoint?

The /v1/admin/* endpoints require a special Global Admin token. If you are using an organization-level API key, you cannot access global customer data. Ensure your integration is using the correct administrative credentials.

AI Content Management

You can leverage AI to edit documentation or generate assets programmatically.

ActionMethodEndpointDescription
Edit contentPOST/documentation/{organization_id}/{documentation_id}/ai/editEdit content using AI.
Generate imagePOST/documentation/{organization_id}/{documentation_id}/ai/generate-imageGenerate an image with AI and store it as an asset.