Skip to main content
The Plugchoice API uses standard HTTP status codes and returns JSON error responses.

Error response format

All error responses include a message field:
{
  "message": "The given data was invalid."
}
Validation errors (422) include field-level details in the errors field:
{
  "message": "The given data was invalid.",
  "errors": {
    "name": ["The name field is required."],
    "email": ["The email must be a valid email address."]
  }
}

HTTP status codes

CodeDescription
200OK - Request succeeded
201Created - Resource created successfully
204No Content - Request succeeded with no response body (e.g., deletes)
400Bad Request - Malformed request
401Unauthorized - Missing or invalid authentication token
403Forbidden - Valid token but insufficient permissions
404Not Found - Resource does not exist
422Unprocessable Entity - Validation errors in request body
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Unexpected server error
504Gateway Timeout - The charger did not respond in time

Common error scenarios

Authentication errors (401)

Returned when no token is provided or the token is expired/revoked:
{
  "message": "Unauthenticated."
}

Authorization errors (403)

Returned when the authenticated user lacks permission for the requested action:
{
  "message": "This action is unauthorized."
}

Charger timeout (504)

Some charger actions (start, stop, restart) communicate with the physical charger in real-time. If the charger doesn’t respond within the timeout period, a 504 is returned:
{
  "message": "The charger did not respond in time."
}
This does not necessarily mean the action failed - the charger may still execute the command.