Skip to main content

Overview

MileApp uses conventional HTTP response codes to indicate the success or failure of an API request.
  • Codes in the 2xx range indicate success
  • Codes in the 4xx range indicate an error that failed given the information provided
  • Codes in the 5xx range indicate an error with MileApp’s servers (these are rare)

HTTP Status Codes

CodeTextDescription
200SuccessIndicates that the request has succeeded.
201CreatedIndicates that the request has succeeded and has led to the creation of a resource.
400Bad RequestFor example, the Create Task requires flow type to be sent and if it is missing, the status code is returned.
401UnauthorizedFor example, all API requires the API key to be sent and if it is missing, the status code is returned.
404Not FoundThis status code is returned when the request contains invalid ID or URL itself. For example, the Read Task by ID API requires taskid to be sent and if it is incorrect ID, the status code is returned.
405Method not AllowedThis API request used the wrong HTTP method. For example, API Get Task by ID used GET method, when you sent PUT method, the status code is returned.
406Unsupported Accept HeaderOnly application/json and */* are supported.
409ConflictIndicates a request conflict with current state of the target resource.
413Payload Too LargeIndicates that the request entity is larger than limits defined by server.
429Too Many RequestsIndicates the user has sent too many requests in a given amount of time.
500Unexpected Server ErrorThis indicates error at MileApp’s side.
503Service UnavailableThe server is not ready to handle the request.
504Gateway TimeoutIndicates that the server did not get a response in time that it needed in order to complete the request.
Most errors will also return a message containing more information to help you debug.

Error Response Format

When an error occurs, the API returns a JSON response with the following structure:
{
  "status": false,
  "message": "Error description here"
}

Failed Code System

All failed responses include a standardized failedCode field to provide machine-readable failed identification. This enables consistent failed handling across different languages and integrations.

Failed Code Format

The failed code follows a structured format: {module}-{type}
  • Module Code: Identifies the system component (max 5 characters)
  • Failed Type Code: Identifies the specific failed type (3-digit number)

Module Codes Reference

ModuleModule CodesDescription
AuthenticationauthManages user authentication and authorization, controlling access to system resources and functionality.
Tasktask, sched, lochi, dispHandles the complete lifecycle of task resources, from creation and scheduling to dispatch and real-time location tracking.
Routingroute, vehic, conf, geo, capac, reslt, rhistProvides a comprehensive suite for route optimization and planning, including vehicle management, capacity constraints, and result logging.
Flowflow, auto, templ, flogHandles the creation and management of flow templates—the blueprints for repeatable processes.
Data Managementdata, dtypeGoverns the management of all data sources and data types within the organization.
Settingsuser, role, hub, passp, priv, cmod, orgdt, org, team, perm, trash, appinManages the core administrative and configuration entities.
Billinglcns, subs, invce, pymntHandles all billing and subscription operations.
Data VersiondverImplements data versioning for critical resources.
App VersionversnResponsible for application version management.
SystemsysContains system-level operations and configurations.

Common Failed Code Examples

Failed CodeDescriptionExample Message
auth-001Required authentication field missingThe email field is required
auth-004Invalid email formatThe email must be a valid email address
auth-005Invalid password formatPassword does not meet requirements
sys-036Rate limit exceededToo many requests
sys-045Internal server errorInternal server error

Validation Errors (001-030)

CodeDescriptionCommon Causes
001Required field missingField not provided in request
002Unique constraint violationDuplicate value for unique field
003Invalid format/patternValue doesn’t match expected format
004Invalid email formatEmail validation failed
005Invalid password formatPassword doesn’t meet requirements
006Invalid phone formatPhone number validation failed
007Invalid URL formatURL format validation failed
008Invalid date/time formatDate/time format incorrect
009Invalid numeric formatNumber validation failed
010Invalid boolean formatBoolean validation failed
011Invalid array formatArray structure validation failed
012Invalid coordinates formatLatitude/longitude validation failed
013Invalid JSON formatJSON structure validation failed
014Confirmation mismatchField confirmation validation failed
015Invalid file formatFile type or size validation failed
016Invalid string formatString pattern validation failed
017Invalid enum/choice valueValue not in allowed options
018Invalid time formatTime format validation failed
019Invalid IP address formatIP address validation failed
020Invalid UUID formatUUID format validation failed
021Invalid MAC address formatMAC address validation failed
030Custom validation failedCustom business rule validation failed

Business Logic Errors (031-099)

Business logic failed codes are module-specific. Each module may implement the same failed code differently based on its business context. For example, task-033 means “Task not found”, while user-033 means “User not found”. Always consider the module prefix when handling these failures.
CodeGeneral DescriptionCommon Causes
031Duplicate entryRecord already exists
032Invalid state/conditionOperation not allowed in current state
033Not foundResource doesn’t exist
034Unauthorized accessMissing or invalid authentication
035Forbidden operationInsufficient permissions
036Rate limit exceededToo many requests
040Limit exceededResource limit reached
045Server errorInternal processing error