Skip to main content

Overview

The ServITech Backend API base URL varies depending on the environment where the application is deployed. All API endpoints should be prefixed with the base URL and /api path.

Environment Configuration

The base URL is configured in the .env file using the APP_URL variable.

Local Development

For local development, the default configuration is:
APP_URL=http://localhost:8000
Complete API Base URL:
http://localhost:8000/api

Production

For production environments, update the APP_URL to your production domain:
APP_URL=https://api.servitech.com
Complete API Base URL:
https://api.servitech.com/api

Making Requests

All API requests should be made to the base URL followed by the specific endpoint path.
# Local Development
curl -X GET "http://localhost:8000/api/articles" \
  -H "Accept: application/json"

# Production
curl -X GET "https://api.servitech.com/api/articles" \
  -H "Accept: application/json"

Environment Variables

The following environment variables affect the API configuration:
VariableDescriptionDefault Value
APP_NAMEApplication nameServITech
APP_VERSIONApplication version1.0.0
APP_ENVEnvironment (local, production)local
APP_URLBase application URLhttp://localhost:8000
APP_LOCALEDefault languagees
APP_FALLBACK_LOCALEFallback languageen
APP_DEBUGDebug mode (true/false)true

API Documentation URL

The API also exposes automatically generated documentation via Scramble:
Local: http://localhost:8000/docs/api
Production: https://api.servitech.com/docs/api
This route is configured via the SCRAMBLE_API_ROUTE environment variable.

CORS Configuration

When making requests from a web browser, ensure that CORS (Cross-Origin Resource Sharing) is properly configured on the server to allow requests from your frontend domain.
In development, you may need to configure CORS to allow requests from http://localhost:3000 or your frontend development server.

HTTPS Requirements

In production environments, always use HTTPS to ensure secure communication between clients and the API. Never transmit sensitive information (passwords, tokens) over unencrypted HTTP connections.

Testing the Connection

To verify your API connection, make a simple GET request to a public endpoint:
curl -X GET "http://localhost:8000/api/articles" \
  -H "Accept: application/json" \
  -H "Accept-Language: en"
A successful response indicates that your API is properly configured and accessible.

Build docs developers (and LLMs) love