Overview
Expedition numbers are unique identifiers assigned to each fine within a municipality. The Alta Multes API uses a sophisticated range allocation system that allows devices to work offline while ensuring no number conflicts occur.Fine Identification
Each fine in the ORGT system is uniquely identified by the combination of:- Fines are unique within the entire ORGT system
- Different municipalities can use the same expedition numbers
- Simple lookups using municipality and expedition number
Expedition numbers are municipality-specific. Municipality 088 and municipality 100 can both have expedition number “0001” without conflict.
Why Ranges Matter
The range system solves a critical challenge: offline operation.The Problem
Without ranges:- Devices would need constant connectivity to get the next available number
- Multiple devices would risk using the same number
- Network failures would prevent fine creation
The Solution
With ranges:- Each device pre-allocates a block of expedition numbers
- Devices work completely offline until their range is exhausted
- No conflicts occur because ranges are exclusive to each device
Range Types
The system provides two types of ranges per device:Range 1 (Primary Range)
The main working range for regular use.- Typically 10-50 numbers
- Used for day-to-day operations
- Requested with
pEstat1=1
Range 2 (Secondary Range)
A backup range for extended offline periods or high-volume scenarios.- Activated after Range 1 is exhausted
- Provides continuity without requiring immediate connectivity
- Requested with
pEstat2=1
Requesting Ranges
Devices request new ranges using theObtenirRang endpoint.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
pImei | string | Device identifier (max 15 chars) |
pEstat1 | integer | 1 to request primary range, 0 to skip |
pEstat2 | integer | 1 to request secondary range, 0 to skip |
Response Format
Request Strategies
Request both ranges at startup:Using Expedition Numbers
When creating a fine, the expedition number must be within your allocated ranges.Fine Creation Example
Validation
The API validates that:- The expedition number is within a range previously allocated to this IMEI
- The number hasn’t been used before
- The municipality code matches the IMEI’s assigned municipality
Range Management Workflow
Format and Constraints
Expedition Number Format
Expedition numbers can have various formats: Numeric:While ranges are typically numeric sequences, the expedition number field itself accepts alphanumeric values. Check your municipality’s specific format requirements.
Field Constraints
- Field name:
Cdexpa - Type: String
- Required: Yes
- Case: Uppercase (all text data must be uppercase)
- Uniqueness: Must be unique within the municipality
Error Handling
Range Request Errors
| Code | Description | Solution |
|---|---|---|
-1 | Application error | Check IMEI is valid and registered |
-9000 | Uncontrolled exception | Contact ORGT support |
Fine Creation Errors
If you use an invalid expedition number:- Using a number outside your allocated ranges
- Reusing a number that was already submitted
- Using a number before requesting ranges
Best Practices
1. Request Ranges Proactively
2. Use Sequential Numbers
Always use expedition numbers sequentially:3. Track Range Usage
Maintain local state:4. Handle Range Exhaustion
5. Persist Range State
Store range information persistently:Multi-Device Considerations
When multiple devices work for the same municipality:Each Device Has Its Own Ranges
- No coordination needed between devices
- Complete independence and offline capability
- No risk of number conflicts
Centralized Applications
For web applications managing multiple municipalities:Testing Expedition Numbers
During testing phases:Pre-production
- Expedition numbers work identically to production
- Numbers are isolated to the test environment
- Safe to experiment without affecting real data
Production Testing
- Use agent codes starting with “USU” (e.g., “USU1”)
- Expedition numbers come from real ranges
- These fines are marked as tests and excluded from the system
Troubleshooting
Problem: “Expedition number already exists”
Cause: Duplicate number submission Solution:- Check local state to ensure numbers aren’t reused
- Verify your increment logic
- Request new ranges if you’ve lost track of usage
Problem: “Expedition number out of range”
Cause: Using a number outside allocated ranges Solution:- Verify the number is between min and max of your ranges
- Request new ranges if exhausted
- Check that you’re using the correct municipality code
Problem: Ranges exhausted unexpectedly
Cause: Higher volume than anticipated Solution:- Request ranges more frequently
- Monitor usage patterns
- Consider requesting larger ranges from ORGT