Error Reference

The Logproof API uses conventional HTTP response codes to indicate the success or failure of an API request. All errors return a JSON object with a consistent structure containing error type and message.

Error Response Format

All API errors return a JSON object with the following structure:

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..." \
  -H "Content-Type: application/json"

# Response (401)
{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key provided"
  }
}
{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key provided"
  }
}

Error Types

The Logproof API returns the following error types along with their corresponding HTTP status codes:

Error Type HTTP Status Description
authentication_error 401 Missing or invalid API key
scope_error 403 API key lacks required scope
plan_feature_unavailable 403 Feature not available on current plan
plan_limit_exceeded 403 / 429 Resource or event limit reached
not_found 404 Resource not found
validation_error 422 Invalid request body
rate_limit_exceeded 429 Too many requests
server_error 500 Internal server error

Error Examples

Authentication Error

Returned when no API key is provided or the API key is invalid.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer invalid_key"

# Response (401)
{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key provided"
  }
}
{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key provided"
  }
}

Scope Error

Returned when the API key does not have the required scope to access the resource.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_readonly_..."

# Response (403)
{
  "error": {
    "type": "scope_error",
    "message": "API key does not have write access"
  }
}
{
  "error": {
    "type": "scope_error",
    "message": "API key does not have write access"
  }
}

Plan Feature Unavailable

Returned when attempting to use a feature not included in the current plan.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..." \
  -H "Content-Type: application/json" \
  -d '{"type": "advanced_feature"}'

# Response (403)
{
  "error": {
    "type": "plan_feature_unavailable",
    "message": "This feature requires a Pro plan or higher"
  }
}
{
  "error": {
    "type": "plan_feature_unavailable",
    "message": "This feature requires a Pro plan or higher"
  }
}

Plan Limit Exceeded

Returned when a resource or event limit has been reached for the current billing period.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..." \
  -H "Content-Type: application/json" \
  -d '{"type": "user.login"}'

# Response (403)
{
  "error": {
    "type": "plan_limit_exceeded",
    "message": "Monthly event limit exceeded. Upgrade your plan to continue."
  }
}
{
  "error": {
    "type": "plan_limit_exceeded",
    "message": "Monthly event limit exceeded. Upgrade your plan to continue."
  }
}

Not Found

Returned when the requested resource does not exist.

curl https://api.logproof.com/v1/events/evt_nonexistent \
  -H "Authorization: Bearer lp_test_..."

# Response (404)
{
  "error": {
    "type": "not_found",
    "message": "Event not found"
  }
}
{
  "error": {
    "type": "not_found",
    "message": "Event not found"
  }
}

Validation Error

Returned when the request body contains invalid or missing required fields.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..." \
  -H "Content-Type: application/json" \
  -d '{"invalid": "data"}'

# Response (422)
{
  "error": {
    "type": "validation_error",
    "message": "The type field is required"
  }
}
{
  "error": {
    "type": "validation_error",
    "message": "The type field is required"
  }
}

Rate Limit Exceeded

Returned when too many requests have been made in a short period of time.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..."

# Response (429)
{
  "error": {
    "type": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Please retry after 30 seconds."
  }
}
{
  "error": {
    "type": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Please retry after 30 seconds."
  }
}

Server Error

Returned when an unexpected error occurs on the server.

curl https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..."

# Response (500)
{
  "error": {
    "type": "server_error",
    "message": "An unexpected error occurred. Please try again later."
  }
}
{
  "error": {
    "type": "server_error",
    "message": "An unexpected error occurred. Please try again later."
  }
}

Handling Errors

Best Practice: Always check the HTTP status code and error type in your application to handle different error scenarios appropriately.

When integrating with the Logproof API, implement error handling that can gracefully handle different error types:

  • Authentication errors (401): Verify your API key is correct and has not been revoked
  • Permission errors (403): Check that your API key has the required scopes and your plan supports the feature
  • Not found errors (404): Verify the resource ID is correct and the resource exists
  • Validation errors (422): Review the error message and correct the request body
  • Rate limit errors (429): Implement exponential backoff and retry logic using the Retry-After header
  • Server errors (500): Retry the request after a short delay with exponential backoff

Important: For production applications, implement proper logging and monitoring of API errors to quickly identify and resolve integration issues.

# Check the HTTP status code in your shell scripts
curl -w "\n%{http_code}" https://api.logproof.com/v1/events \
  -H "Authorization: Bearer lp_test_..."
try {
  const response = await fetch('https://api.logproof.com/v1/events', {
    headers: {
      'Authorization': 'Bearer lp_test_...',
      'Content-Type': 'application/json'
    }
  });

  if (!response.ok) {
    const error = await response.json();

    switch (error.error.type) {
      case 'authentication_error':
        console.error('Invalid API key');
        break;
      case 'rate_limit_exceeded':
        const retryAfter = response.headers.get('Retry-After');
        console.error(`Rate limited. Retry after ${retryAfter}s`);
        break;
      case 'validation_error':
        console.error('Validation error:', error.error.message);
        break;
      default:
        console.error('API error:', error.error.message);
    }
  }
} catch (err) {
  console.error('Network error:', err);
}
import requests
from time import sleep

def call_logproof_api():
    try:
        response = requests.post(
            'https://api.logproof.com/v1/events',
            headers={'Authorization': 'Bearer lp_test_...'},
            json={'type': 'user.login'}
        )

        if response.status_code != 200:
            error = response.json()['error']

            if error['type'] == 'authentication_error':
                print('Invalid API key')
            elif error['type'] == 'rate_limit_exceeded':
                retry_after = int(response.headers.get('Retry-After', 60))
                print(f'Rate limited. Retrying after {retry_after}s')
                sleep(retry_after)
                return call_logproof_api()  # Retry
            elif error['type'] == 'validation_error':
                print(f'Validation error: {error["message"]}')
            else:
                print(f'API error: {error["message"]}')

    except requests.exceptions.RequestException as e:
        print(f'Network error: {e}')