User Management API

User Management API

This guide covers how to use user management functionality in the Connector platform. The user management system allows you to create users, authenticate them, and manage their third-party integrations.

Prerequisites

Before using the user management APIs, you'll need:

  • API Client Key: Your API client key for authentication

  • API URL: The base URL for GL Connector API (e.g., https://connector.gdplabs.id)

All API requests must include your API client key in the x-api-key header.

Authentication Flow

The typical user management flow involves:

  1. Creating a user account

  2. Authenticating the user to get a Bearer token

  3. Using the Bearer token for authenticated requests

  4. Managing third-party integrations


API Endpoints

1. Create User

Creates a new user account in the GL Connectors system.

Endpoint: POST /users

Headers:

  • x-api-key: Your GL Connectors API client key

  • Content-Type: application/json

Request Body:

Example Request:

Response:

⚠️ Important: Save the secret value immediately. GL Connectors will not provide it again and does not store this secret for security reasons.

2. User Authentication (Login)

Authenticates a user and returns a Bearer token for subsequent API calls.

Endpoint: POST /auth/tokens

Headers:

  • x-api-key: Your GL Connectors API client key

  • Content-Type: application/json

Request Body:

Example Request:

Response:

Use the returned token as a Bearer token for authenticated requests.

⚠️ Important: you can reuse the bearer token until it's expired. Please reuse them if you can to prevent security risks due the previous token will not expired when you generate new bearer token.

3. Get User Details

Retrieves detailed information about the authenticated user, including their integrations.

Endpoint: GET /users/me

Headers:

  • x-api-key: Your GL Connectors API client key

  • Authorization: Bearer {your-bearer-token}

Example Request:

Response:

This endpoint returns the user's profile information and all active third-party integrations.

4. Create Third-Party Integration

Initiates integration with third-party services like Google, GitHub, etc.

Endpoint: POST /connectors/{third_party}/integrations

Available Third-Party Services:

  • google - Google services integration

  • github - GitHub integration

  • And more...

Headers:

  • x-api-key: Your GL Connectors API client key

  • Content-Type: application/json

  • Authorization: Bearer {your-bearer-token}

Request Body:

Example Request (Google Integration):

The callback_url is where users will be redirected after successfully authenticating with the third-party service.

5. Remove Third-Party Integration

Removes an existing integration with a third-party service.

Endpoint: DELETE /connectors/{third_party}/integrations/{user_identifier}

Available Third-Party Services:

  • google - Google services integration

  • github - GitHub integration

  • And more...

Headers:

  • x-api-key: Your GL Connectors API client key

  • Content-Type: application/json

  • Authorization: Bearer {your-bearer-token}

You can check all user identifier across all integrations via GET /clients/user

Example Request (Remove Github Integration):

This will remove the integration for the specified third-party service and account.


Error Handling

All endpoints return standard HTTP status codes:

  • 200 - Success

  • 400 - Bad Request (invalid parameters)

  • 401 - Unauthorized (invalid API key or Bearer token)

  • 404 - Not Found

  • 500 - Internal Server Error

Error responses will include details about what went wrong:


Best Practices

  1. Secure Secret Storage: Always store user secrets securely and never log them

  2. Token Management: Monitor token expiration times and refresh as needed

  3. Error Handling: Implement proper error handling for all API calls


Additional Resources

For more comprehensive API documentation and additional endpoints, visit our complete API documentation at API Reference

This interactive documentation provides detailed information about all available endpoints, request/response schemas, and testing capabilities.

Last updated