Create Trip API v1

The Create Trip API helps you to create a new trip with an origin, destination, and user.

Create Trip API

POST https://api.roam.ai/v1/api/trips/

Headers

Name
Type
Description

Api-key

string

Auth-key E.g.- 33223kjhdcscijhb5sdbsdmjsdcbj5f

Request Body

Name
Type
Description

user_id

string

User-id for which the trip needs to be assigned E.g.- 5d9450ace47bae6d70064a9b

origins

array

Single or multiple origin locations in [long, lat] format. E.g.- [[77.677270, 12.914131]]

destinations

array

Single or multiple destination locations in [long, lat] format. E.g.- [[77.700475, 12.957005]]

{
    "status": true,
    "msg": "Success.",
    "code": 201,
    "data": [
        {
            "id": "<ID>",
            "origins": [
                {
                    "id": "<ID>",
                    "trip_id": "<TRIP-ID>",
                    "created_at": "2020-09-22T06:00:34.264",
                    "updated_at": "2020-09-22T06:00:34.269",
                    "coordinates": {
                        "type": "Point",
                        "coordinates": [
                            77.622977,
                            12.917042
                        ]
                    },
                    "loc_type": "origin"
                }
            ],
            "destinations": [
                {
                    "id": "<ID>",
                    "trip_id": "<TRIP-ID>",
                    "created_at": "2020-09-22T06:00:34.272",
                    "updated_at": "2020-09-22T06:00:34.275",
                    "coordinates": {
                        "type": "Point",
                        "coordinates": [
                            77.650239,
                            12.924304
                        ]
                    },
                    "loc_type": "destination"
                },
                {
                    "id": "<ID>",
                    "trip_id": "<TRIP-ID>",
                    "created_at": "2020-09-22T06:00:34.278",
                    "updated_at": "2020-09-22T06:00:34.281",
                    "coordinates": {
                        "type": "Point",
                        "coordinates": [
                            77.697418,
                            12.959172
                        ]
                    },
                    "loc_type": "destination"
                }
            ],
            "events": [],
            "user_id": "<USER-ID>",
            "is_started": false,
            "is_ended": false,
            "is_deleted": false,
            "created_at": "2021-06-22T06:00:34.261",
            "updated_at": "2021-06-22T06:00:34.261",
            "trip_tracking_url": "https://trips.gs/NWY2OTkzMDI5NzI0MjIwNThmY2ZjYTFlfHNmZHNnZHNh"
        }
    ]
}
curl --location --request POST 'https://api.roam.ai/v1/api/trips/' \
--header 'Api-key: <API-KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
	"user_id": "<USER-ID>",
	"origins": [[77.622977 ,12.917042]],
    "destinations":[[77.650239 ,12.924304], [77.697418 ,12.959172]]
}'

Last updated