# Quick start

> From an API key to a delivery on its way, in five calls.

You need an API key with the `delivery` scope. Keep it in your shell:

```bash
export REMI_API_KEY='live_sk_...'
```

## 1. Create your partner

Your partner is your account. Your key decides which one; create it once.

```bash
curl -X POST 'https://api.remi.robot.com/api/v3/partners' \
  -H "Authorization: Bearer $REMI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"name": "Acme Logistics"}'
```

## 2. Create a location

A location is the area your bots serve. `polygon.coordinates` is a flat list of `[lng, lat]` pairs. Keep `data.id` from the response.

```bash
curl -X POST 'https://api.remi.robot.com/api/v3/locations' \
  -H "Authorization: Bearer $REMI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "full_name": "Downtown Campus",
    "short_name": "DTC",
    "country_code": "CO",
    "city_name": "Bogotá",
    "polygon": {
      "type": "Polygon",
      "coordinates": [[-74.0712, 4.6498], [-74.0521, 4.6498], [-74.0521, 4.6602], [-74.0712, 4.6602], [-74.0712, 4.6498]]
    }
  }'
```

## 3. Add a pickup point

A point is a named place in the location, like a kitchen. Tag it `pickup`.

```bash
curl -X POST 'https://api.remi.robot.com/api/v3/points' \
  -H "Authorization: Bearer $REMI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "location_id": "7Nk2QhVpXrLmT4wZaBcDe",
    "external_id": "kitchen-north",
    "name": "North Kitchen",
    "lat": 4.6512,
    "lng": -74.0689,
    "tags": ["pickup"]
  }'
```

## 4. Create a delivery

Refer to the pickup by your `external_id` and send the dropoff as coordinates.

```bash
curl -X POST 'https://api.remi.robot.com/api/v3/delivery' \
  -H "Authorization: Bearer $REMI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "external_id": "order-4821",
    "location_id": "7Nk2QhVpXrLmT4wZaBcDe",
    "pickup": { "external_id": "kitchen-north" },
    "dropoff": { "lat": 4.6602, "lng": -74.0521, "contact": { "name": "Noah", "phone": "+573001234567" } },
    "packages": [{ "reference": "bag-1", "items": [{ "name": "Cheeseburger", "quantity": 1 }] }]
  }'
```

The answer is `201` with the delivery: its `id` (like `ES-5867`), `state: pending` and a `tracker_url` for your customer. REMI assigns a bot and starts it.

## 5. Follow it

- Read it with `GET /delivery/{id}`, or `GET /delivery/order-4821?id_type=external`.
- At `at_pickup`: `POST /delivery/{id}/load/start` opens the door, `POST /delivery/{id}/load/finish` sends the bot off.
- At `at_dropoff`: `unload/start`, then `unload/finish`. The delivery is `delivered`.

Next: [Track a delivery](https://docs.remi.robot.com/delivery/lifecycle), [Load and unload](https://docs.remi.robot.com/delivery/loading), [Webhooks](https://docs.remi.robot.com/delivery/webhooks).
