NAV Navbar
Logo
text shell

Introduction

Welcome to the Urbaner API documentation. This document describes the resources and endpoints publicly available to developers. If you have any problems or requests please contact support

Root Endpoint

curl https://api.sandbox.urbaner.com/api/

https://api.sandbox.urbaner.com/api/

Authentication

To authenticate against Urbaner CI, you need an API access token.

Token

You can retrieve a token by using authenticating, we are planning to add a proper OAuth handshake for third party applications.

POST https://api.sandbox.urbaner.com/api/client/authenticate/
Content-Type: multipart/form-data

{
  "email": "your@email",
  "password": "your password"
}
curl -X POST --header "content-type: multipart/form-data" --data-binary "{
  \"email\": \"example@urbaner.pe\",
  \"password\": \"example\"
}" https://api.sandbox.urbaner.com/api/client/authenticate/

JWT Token

You can retrieve a JWT token by using this endpoint

POST https://api.sandbox.urbaner.com/api/client/authenticate/jwt/
Content-Type: application/json

{
  "email": "your@email",
  "password": "your password"
}
curl -X POST --header "content-type: application/json" --data-binary "{
  \"email\": \"example@urbaner.pe\",
  \"password\": \"example\"
}" https://api.sandbox.urbaner.com/api/client/authenticate/jwt/

HTTP Verbs

Where possible, the API strives to use appropriate HTTP verbs for each action.

Verb Description
HEAD Can be issued against any resource to get just the HTTP header info.
GET Used for retrieving resources.
POST Used for creating resources.
PATCH Used for updating resources with partial JSON data.
PUT Used for replacing resources or collections.
DELETE Used for deleting resources.

Status Codes

The Urbaner API uses HTTP status codes to indicate the status of your requests. This includes successful and unsuccessful responses.

Responses will also include JSON formatted details for further details.

Status Code Description
200 OK: Everything went as planned.
201 Created.
204 OK but no content
304 Not Modified: Resource hasn’t been updated since the date provided.
400 Bad Request: Something went wrong with your request, most likely a missing argument or parameter.
401 Unauthorized: Authentication was incorrect.
403 Forbidden: You don’t have the necessary permissions for the resource.
404 Not Found.
500 Internal Server Error: We had a problem processing the request.
503 Service Unavailable: Try again later.

Pagination

Requests that return multiple items will be paginated to 15 items by default.

List of Values

Order Types

order_type_id name
1 Express
2 Sameday
3 Nextday

Vehicle Types

vehicle_id name
1 Bicicleta
2 Moto
3 Auto

Payment Types

======== CARD PAYMENT ========
{
    "backend": "card",
    "args": {
        "bankcard": 120
    }
}
======== PURSE PAYMENT ========
{
    "backend": "purse"
}
======== CREDIT PAYMENT ========
{
    "backend": "credit"
}
backend description
card Use your Credit Card associated
purse Use your Purse
credit Use your accepted Credit

Data Detail

Origin/Destination

{
    "contact_person": "Visanet",
    "phone": "987945643",
    "address": "Jorge Chavez 184, Miraflores 15074, Peru",
    "latlon": "-12.119847 ,  -77.0370547",
    "interior": "5",
    "special_instructions": "near a supermarket",
    "email": "hello@email.com"
}
parameter type description
contact_person string Name of the Person
phone string Phone
address string Address
latlon string Coordinates
interior string Description of the rating
special_instructions string Some reference of the address
email string Email

Endpoints

Create Order - /cli/order/

POST https://api.sandbox.urbaner.com/api/cli/order/
Content-Type: application/json
Authorization: token << YOUR TOKEN >>

{
    "type": "1",
    "destinations": [
    {
      "contact_person": "Visanet",
      "phone": "987945643",
      "address": "Jorge Chavez 184, Miraflores 15074, Peru",
      "latlon": "-12.119847 ,  -77.0370547",
      "interior": "5",
      "special_instructions": "",
      "email": ""
    },
    {
      "contact_person": "Cliente de Visanet",
      "phone": "987456321",
      "address": "Avenida La Marina 550,  Pueblo Libre",
      "latlon": "-12.0813873 , -77.07160499999999",
      "interior": "5",
      "special_instructions": "",
      "email": ""
    }
    ],
    "payment": {
        "backend": "purse"
    },
    "description": "comida",
    "vehicle_id": "2",
    "memo": "Orden #34",
    "programmed_date": "2017-11-10 13:00:00"
    "is_return": "true",
}

====================================================================

SUCCESSFUL RESPONSE

{
  "id": 1111,
  "code": "BDAY-3j3b5bdi",
  "status": "searching",
  "tracking": "https://webapp.sandbox.urbaner.com/tracking/?data=MjEzMA:1eAgyF:YmpQotOSbZXPrLRIJcS4Y_TamJk"
}

You can create an order with the next parameters.

parameter type required description
type string * ID of type of order
description string * Description of the order
memo string * Memo of the order
payment {} * Backend of the payment (See the Payment Types section)
destinations [] * List of Destinations with minimun 2 (See the Origin/Destination section)
vehicle_id string * ID of vehicle
programmed_date timestamp * Date and hour of the Order that must be delivered (This parameter only work with EXPRESS Orders)
is_return boolean * If the Courier return to the origin point ‘true’, otherwise ‘false’
curl --request POST \
  --url https://api.sandbox.urbaner.com/api/cli/order/ \
  --header 'cache-control: no-cache' \
  --header 'token: << YOUR TOKEN >>' \
  --data '{\n    "type": "1",\n    "destinations": [\n    {\n      "contact_person": "Visanet",\n      "phone": "987945643",\n      "address": "Jorge Chavez 184, Miraflores 15074, Peru",\n      "latlon": "-12.119847 ,  -77.0370547",\n      "interior": "5",\n      "special_instructions": "",\n      "email": ""\n    },\n    {\n      "contact_person": "Cliente de Visanet",\n      "phone": "987456321",\n      "address": "Avenida La Marina 550,  Pueblo Libre",\n      "latlon": "-12.0813873 , -77.07160499999999",\n      "interior": "5",\n      "special_instructions": "",\n      "email": ""\n    }\n    ],\n    "payment": {\n        "backend": "purse"\n    },\n    "description": "comida",\n    "vehicle_id": "2",\n    "memo": "Orden #34",\n    "programmed_date": "2017-11-10 13:00:00"\n    "is_return": "true",\n}'

Calculate Price - /cli/price/

POST https://api.sandbox.urbaner.com/api/cli/price/
Content-Type: application/json
Authorization: token << YOUR TOKEN >>

{
    "destinations": [
        {
            "latlon": "-12.119847 ,  -77.0370547"
        },
        {
            "latlon": "-12.0813873 , -77.07160499999999"
        }
    ],
    "package_type_id": 1,
    "is_return": true
}

====================================================================

SUCCESSFUL RESPONSE

{
    "distance": 14664,
    "duration": 2561,
    "prices": [
        {
            "order_type": "EXPRESS",
            "price": 21.6
        },
        {
            "order_type": "SAMEDAY",
            "price": 11
        }
    ]
}

You can calculate the price of an Order using the next parameters

parameter type required description
order_type_id string ID of type of order
destinations [] * List of Destinations
package_type_id string * ID of package type (See the Vehicle Types section). If you do not pass this parameter, it will return all the package_types with the price
is_return boolean * Return to the origin point
curl --request POST \
  --url https://api.sandbox.urbaner.com/api/cli/order/ \
  --header 'cache-control: no-cache' \
  --header 'token: << YOUR TOKEN >>' \
  --data '{\n  "order_type_id": 1,\n  "destinations": [\n   {\n     "latlon": "-12.119847 ,  -77.0370547"\n },\n    {\n     "latlon": "-12.0813873 , -77.07160499999999"\n  }\n  ],\n  "package_type_id": 1,\n  "is_return": true\n}'