Skip to main content

Create Violation Endpoint

POST /spsr-api/v1/violations/public

Authentication

  • Type: Bearer Token (JWT) – Operator Token
  • Example:
    Authorization: Bearer xxxxxx

Request Format

Headers

NameValue
AuthorizationBearer xxxxx
Content-Typemultipart/form-data

Form Data

FieldTypeDescription
datestringtimestamp
latitudedoubleLatitude of violation
longitudedoubleLongitude of violation
locationstringViolation location text
plateNumberstringVehicle plate number
plateTypestring enumType of vehicle plate
zoneIdstringZone UUID
imagesDescriptionstringDescription of violation images
violationTypestring enumType of violation
isSaudibooleanWhether the plate is Saudi
metadatajsonOptional metadata field
fullNamestringReporter full name
identityNumberstringReporter identity number
mobileNumberstringReporter mobile number
supervisorFullNamestringReporter full name
supervisorIdentityNumberstringReporter identity number
supervisorMobileNumberstringReporter mobile number
imagesfile[]One or more image files (max 10MB total)

Sample curl Request

curl --location '{baseUrl}/spsr-api/v1/violations/public' \
--header 'Authorization: Bearer xxxxxx' \
--form 'date=2025-04-08T12:00:00Z' \
--form 'latitude=24.774265' \
--form 'longitude=46.738586' \
--form 'location=Riyadh' \
--form 'plateNumber=2482KXR' \
--form 'plateType=PRIVATE' \
--form 'zoneId=8204c677-34b8-4e53-9ac5-97d6c6f000cf' \
--form 'imagesDescription=no ticket violation' \
--form 'violationType=NO_TICKET' \
--form 'isSaudi=true' \
--form 'metadata="{ \"id\" : \"123456\" }"' \
--form 'fullName=test test' \
--form 'identityNumber=1234567890' \
--form 'mobileNumber=0555555555' \
--form 'supervisorFullName=test test' \
--form 'supervisorIdentityNumber=1234567890' \
--form 'supervisorMobileNumber=0555555555' \
--form 'images=@"/path/to/image.jpg"' 

Enum Values

plateType

  • PRIVATE
  • PUBLIC_TRANSPORTATION
  • PRIVATE_TRANSPORTATION
  • PUBLIC_MINIBUS
  • PRIVATE_MINIBUS
  • TAXI
  • Heavy_Equipment
  • EXPORT
  • DIPLOMATIC
  • MOTORCYCLE

violationType

  • NO_TICKET
  • TICKET_ENDED
  • USER_EXCEED_PARKING_TIME
  • WRONG_PARKING
  • RESERVED_PARKING
  • OBS_CLS_PARKING
  • EMRG_PARKING
  • ENT_EXT_PARKING
  • PROH_PARKING

Success Response

{
  "code": 200,
  "message": "OK",
  "data": {
    "violation_reference_id": "V-20250409-ae732f",
    "status": "PENDING",
    "metadata": {
      "id": "12345"
    }
  }
}

Error Responses

HTTP CodeMessageDescription
400Zone not foundThe provided zone_id is invalid or does not exist
400Image size exceeds limitUploaded image(s) exceed the 10MB file size limit
400Missing required fieldA required field in the violation object is missing
400Invalid enum valueWrong value provided for plate_type or violation_type
401UnauthorizedBearer token is missing or expired
403Access deniedThe user does not have permission to use this endpoint
500Internal Server ErrorA server-side error occurred