API/Tracking

Getting Delivery Code.

Allow your clients to retrieve their delivery code directly from your service.

Endpoint

Returns all relevant completion state information of a given job.

GET Endpoint
https://app.logisapp.ca/api/apikeys/get_delivery_code

Authentification

This endpoint requires authentification via a custom API key header.

Required Header
LOGIS-API-KEY: YOUR_SECRET_API_KEY

The API key used must have the "Allow Public Track" permission enabled in the Logis settings.

Request Parameters

This endpoint accepts query parameters in the url. Both parameters are mandatory.

ParameterTypeRequiredDescription
job_idstringYesThe UUID of the job for which the code is requested.
review_keystringYesThe unique UUID review key associated with the job, used for client verification.

The review_key acts as a secure token to verify that the request likely originates from the intended recipient (or a system acting on their behalf). This key is usually sent to the client via SMS or email through Logis' notification system (e.g., in the public tracking link). You can retrieve the review_key for a specific job using the Fetch Job Track endpoint.

Example URL

GET /api/apikeys/get_delivery_code?job_id=job_uuid4_id&review_key=review_uuid4_key

Success Response

The endpoint returns a 200 OK status code, and a LOT of data.

Response Body
{
  "secret_code": "A9X3B7" // Example 6-character code
}

Error responses

Status CodeError Code / ReasonDescription
400 Bad RequestMissing Parameters (job_id, review_key)One or both of the required query parameters were missing.
400 Bad RequestInvalid review_key formatThe provided review_key was not a valid UUID format.
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_delivery_code)The API key used does not have permission to retrieve delivery codes.
404 Not FoundInvalid job_id or review_keyNo job was found matching the provided job_id and review_key combination.
412 Precondition FailedDelivery Not Code SecuredThe specific job requested is either not configured for secure code delivery, or no code exists.
429 Too Many RequestsRate Limit Exceeded (Key or Global)The API key's hourly limit or the user's global daily limit was exceeded.

Code Examples

Future<String?> getDeliveryCode(String jobId, String reviewKey, String apiKey) async {
  final Map<String, String> queryParams = {
    'job_id': jobId,
    'review_key': reviewKey,
  };
  final uri = Uri.parse('https://app.logisapp.ca/api/apikeys/get_delivery_code/')
             .replace(queryParameters: queryParams);
 
  final Map<String, String> headers = {
    'LOGIS-API-KEY': apiKey,
  };
 
  try {
    final response = await http.get(uri, headers: headers);
    final decodedBody = json.decode(response.body);
 
    if (response.statusCode == 200 && decodedBody != null && decodedBody['secret_code'] is String) {
      debugPrint('Delivery code fetched successfully.');
      return decodedBody['secret_code'];
    } else {
      final errorMessage = decodedBody['error'] ?? 'Request failed with status: ${response.statusCode}';
      debugPrint('LogisService API error (getDeliveryCode): $errorMessage');
      throw Exception(errorMessage); // Or return null depending on desired error handling
    }
  } catch (error) {
    debugPrint('LogisService Network/Request error (getDeliveryCode): $error');
    throw Exception('Failed to fetch delivery code: $error'); // Or return null
  }
}

On this page