Skip to main content

Me

The /me organization endpoint provides access to the current user's organizational context within the GATE API system. This endpoint allows applications to retrieve essential organization details for the authenticated user, enabling proper scoping of resources and permissions based on organizational membership.

Base URL: https://gate.zequenze.com/api/v1

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Overview

The /me API category focuses on user-centric information retrieval, specifically providing access to the authenticated user's organizational context. This endpoint is fundamental for applications that need to understand the user's organizational scope before making other API calls.

Understanding a user's organization is critical for:

  • Resource Scoping: Ensuring users only see resources they have permission to access within their organization
  • Multi-tenant Applications: Properly segregating data and functionality based on organizational boundaries
  • User Context: Displaying relevant organizational information in user interfaces
  • Permission Management: Making authorization decisions based on organizational membership and roles

This endpoint is typically called early in an application's initialization process to establish the user's organizational context, which then informs subsequent API interactions and data filtering.


Endpoints

GET /me/organization/

Description: Retrieves comprehensive organization information for the currently authenticated user. This endpoint returns details about the organization the user belongs to, including organizational metadata, settings, and the user's role within that organization. Essential for establishing organizational context in multi-tenant applications.

Use Cases:

  • Initialize application with user's organizational context
  • Display organization name and details in user interface headers
  • Determine organizational permissions and feature availability
  • Validate user's organizational membership before accessing protected resources

Full URL Example:

https://gate.zequenze.com/api/v1/me/organization/

Parameters:

This endpoint does not accept query parameters. It returns organization information based on the authenticated user's token.

cURL Example:

curl -X GET "https://gate.zequenze.com/api/v1/me/organization/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Example Response:

{
  "id": 12345,
  "name": "Acme Corporation",
  "slug": "acme-corp",
  "display_name": "Acme Corporation",
  "description": "Leading provider of enterprise solutions",
  "status": "active",
  "subscription_tier": "enterprise",
  "created_at": "2023-01-15T09:30:00Z",
  "updated_at": "2024-02-20T14:45:00Z",
  "settings": {
    "timezone": "America/New_York",
    "date_format": "MM/DD/YYYY",
    "currency": "USD",
    "allow_api_access": true,
    "max_users": 500
  },
  "features": [
    "advanced_reporting",
    "api_access",
    "sso_integration",
    "custom_branding"
  ],
  "user_role": {
    "name": "Administrator",
    "permissions": [
      "manage_users",
      "view_reports",
      "api_access",
      "manage_settings"
    ]
  },
  "billing": {
    "plan": "Enterprise Pro",
    "status": "active",
    "next_billing_date": "2024-03-01T00:00:00Z"
  },
  "contact": {
    "email": "admin@acme-corp.com",
    "phone": "+1-555-0123",
    "address": {
      "street": "123 Business Ave",
      "city": "New York",
      "state": "NY",
      "postal_code": "10001",
      "country": "US"
    }
  }
}

Response Codes:

Status Description
200 Success - Returns the user's organization information
401 Unauthorized - Invalid, expired, or missing API token
403 Forbidden - Token is valid but lacks permission to access organization data
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Server encountered an error processing the request

Common Use Cases

Use Case 1: Application Initialization

When a user logs into your application, call this endpoint to retrieve their organizational context. Use the returned data to configure the user interface, set appropriate permissions, and filter available features based on the organization's subscription tier and enabled features.

Use Case 2: Multi-tenant Data Filtering

Before displaying resources like devices, users, or reports, use the organization ID from this endpoint to ensure you're only requesting and displaying data that belongs to the user's organization, maintaining proper data isolation.

Use Case 3: Feature Availability Checking

Check the features array and subscription_tier to dynamically enable or disable functionality in your application. For example, only show advanced reporting options if "advanced_reporting" is present in the features list.

Use Case 4: User Interface Customization

Use the organization's name, display_name, and settings like timezone and date_format to customize the user experience, showing data in the organization's preferred formats and branding.

Use Case 5: Permission Validation

Examine the user_role.permissions array to determine what actions the current user can perform within their organization, enabling proper authorization checks before allowing sensitive operations.


Best Practices

  • Cache Organization Data: Since organizational information changes infrequently, consider caching the response for a reasonable period (e.g., 1 hour) to reduce API calls and improve application performance.

  • Handle Permission Changes: Organization settings and user roles can change. Implement proper error handling for 403 responses and consider refreshing organization data when permission-related errors occur.

  • Validate Feature Access: Always check both the organization's available features and the user's role permissions before enabling functionality. An organization might have a feature available, but the specific user might not have permission to use it.

  • Time Zone Handling: Use the organization's timezone setting to display all dates and times in the user's expected format. This is especially important for scheduling, logging, and reporting features.

  • Graceful Degradation: If the endpoint is temporarily unavailable, ensure your application can still function with cached or default organizational data, but clearly indicate when live data isn't available.

  • Security Considerations: Never expose sensitive organization data (like billing information) to unauthorized users, and always validate that the requesting user has permission to view organizational details before displaying them in your UI.