SAM API Documentation

Comprehensive guide to using the SAM API endpoints

Authentication

All API requests require authentication using a Bearer token. Include the token in the Authorization header of your requests.

Authorization: Bearer your_api_token_here

Getting an API Token

To obtain an API token, make a POST request to the authentication endpoint with your credentials:

POST /api/auth/login

Request body (JSON):

{
    "email": "your.email@example.com",
    "password": "your_password"
}

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of a request.

200 OK - The request was successful
201 Created - Resource was successfully created
400 Bad Request - Invalid request format or parameters
401 Unauthorized - Authentication failed or not provided
403 Forbidden - Insufficient permissions
404 Not Found - Resource not found
500 Internal Server Error - Server error

Error Response Format

Error responses include a JSON object with details about what went wrong:

{
    "message": "The given data was invalid.",
    "errors": {
        "email": ["The email field is required."]
    }
}