Skip to content
This repository was archived by the owner on Jun 2, 2026. It is now read-only.

Repository files navigation

gonfleet

The official Onfleet Go client library.

Installation

go get github.com/onfleet/gonfleet

Documentation

Below are a few examples.

For comprehensive documentation / examples, visit Onfleet API reference

Initialize Client

import (
"log""os""github.com/onfleet/gonfleet/client"
)
apiKey:=os.Getenv("onfleet_api_key")
client, err:=client.New(apiKey, nil)
iferr!=nil {
log.Fatal(err)
}
// do something with client ...

Tasks

import (
"fmt""github.com/onfleet/gonfleet""github.com/onfleet/gonfleet/client"
)
params:= onfleet.TaskParams{
Destination: onfleet.DestinationCreateParams{
Address: onfleet.DestinationAddress{
Number: "8221",
Street: "Sunset Blvd",
City: "Los Angeles",
State: "CA",
PostalCode: "90046",
Country: "US",
},
},
Recipients: []onfleet.RecipientCreateParams{
{
Name: "Kurt Cobain",
Phone: "+13105550107",
},
},
PickupTask: true,
}
task, err:=client.Tasks.Create(params)
iferr!=nil {
fmt.Println(err)
return
}
// do something with task ...

Workers

import (
"fmt""github.com/onfleet/gonfleet""github.com/onfleet/gonfleet/client"
)
params:= onfleet.WorkerCreateParams{
Addresses: &onfleet.WorkerCreateParamsAddressRouting{
Routing: "destination_id",
},
Capacity: 10,
Teams: []string{"team_id_a", "team_id_b"},
Name: "Janis Joplin",
Phone: "+13105550101",
Vehicle: &onfleet.WorkerCreateParamsVehicle{
Type: onfleet.WorkerVehicleTypeBicycle,
},
}
worker, err:=client.Workers.Create(params)
iferr!=nil {
fmt.Println(err)
return
}
// do something with worker ...

About

Go Onfleet API wrapper

Resources

Stars

4 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages