API/Jobs

Deletion

API endpoint for deleting an existing delivery job via an API key.

Note: This action is irreversible. Once a job is deleted, it cannot be recovered. Ensure you have the correct job_id.

Endpoint

Deletes an existing job specified by its ID.

DELETE Endpoint
https://app.logisapp.ca/api/apikeys/delete_order

Authentification

This endpoint requires authentification via a custom API key header.

Required Header
LOGIS-API-KEY: YOUR_SECRET_API_KEY

"Allw Job Deletion" permission must also be enabled in the Logis settings.

Request Body

This endpoint expects a JSON payload in the request body containg the ID of the job, as saved on Logis, to be deleted.

Request Body Example
{
  "job_id": "job-uuid-to-be-deleted" // Required
}

Field Descriptions

FieldTypeRequiredDescription
job_idstringYesThe UUID of the job to delete.

Success Response

{
  "message": "Job deleted successfully."
}

Error Responses

Status CodeError Code / ReasonDescription
400 Bad RequestMissing job_idThe job_id field was missing from the request body.
401 UnauthorizedMissing LOGIS-API-KEY headerThe required API key header was not included.
403 ForbiddenInvalid/Inactive LOGIS-API-KEYThe provided API key is not valid or is inactive.
403 ForbiddenPermission Denied (allow_job_deletion)The API key used does not have permission to delete jobs.
403 ForbiddenInsufficient PermissionsThe user associated with the API key does not have permission to delete this specific job.
404 Not FoundJob Not FoundNo job exists with the provided job_id.

Code Example

Future<void> deleteOrder(String jobIdToDelete, String apiKey) async {
  final String url = 'https://app.logisapp.ca/api/apikeys/delete_order';
  final Map<String, String> headers = {
    'Content-Type': 'application/json',
    'LOGIS-API-KEY': apiKey,
  };
  final Map<String, String> body = {
    'job_id': jobIdToDelete,
  };
 
  try {
    final response = await http.delete( // Use http.delete
      Uri.parse(url),
      headers: headers,
      body: json.encode(body), // Encode body for DELETE
    );
 
    if (response.statusCode == 200) {
      print('Job $jobIdToDelete deleted successfully.');
      // Optionally parse the success message: json.decode(response.body)['message']
      return; // Indicate success
    } else {
      // Attempt to parse error message from body
      String errorMessage = 'Request failed with status: ${response.statusCode}';
      try {
        final decodedBody = json.decode(response.body);
        if (decodedBody != null && decodedBody['error'] is String) {
          errorMessage = decodedBody['error'];
        }
      } catch (_) { /* Ignore JSON parsing errors on failure */ }
      print('LogisService API error (delete): $errorMessage');
      throw Exception(errorMessage);
    }
  } catch (error) {
    print('LogisService Network/Request error (delete): $error');
    throw Exception('Failed to delete job: $error');
  }
}

On this page