# Create an easypost pickup

To [create](https://docs.commercelayer.io/core/creating-resources) a new easypost pickup, send a `POST` request to the `/api/easypost_pickups` endpoint, passing the resource arguments in the request body.

## Request

**POST** <https://yourdomain.commercelayer.io/api/easypost\\_pickups>

### Arguments

| Body Parameter                   | Type       | Required |
| -------------------------------- | ---------- | -------- |
| **type**                         | `string`   | Required |
| attributes.**reference**         | `string`   | Optional |
| attributes.**reference\_origin** | `string`   | Optional |
| attributes.**metadata**          | `object`   | Optional |
| attributes.**instructions**      | `string`   | Optional |
| attributes.**min\_datetime**     | `datetime` | Required |
| attributes.**max\_datetime**     | `datetime` | Required |
| relationships.**shipment**       | `object`   | Required |

### Example

{% tabs %}
{% tab title="Request" %}
The following request creates a new easypost pickup:

```shell
curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/easypost_pickups' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "easypost_pickups",
    "attributes": {
      "min_datetime": "2018-01-01T12:00:00.000Z",
      "max_datetime": "2018-01-01T12:00:00.000Z"
    },
    "relationships": {
      "shipment": {
        "data": {
          "type": "shipments",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `201 Created` status code, returning the created resource object:

```json
{
  "data": {
    "id": "XAyRWNUzyN",
    "type": "easypost_pickups",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN"
    },
    "attributes": {
      "type": "easypost_pickups",
      "status": "unknown",
      "internal_id": "pickup_13e5d7e2a7824432a07975bc553944bc",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANY-EXTERNAL-REFEFERNCE",
      "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
      "metadata": {
        "foo": "bar"
      },
      "selected_rate_id": "pickuprate_a6cd2647a898410aa5d33febde44e1b2",
      "rates": [
        {
          "id": "pickuprate_a6cd2647a898410aa5d33febde44e1b2",
          "rate": "45.59",
          "carrier": "USPS",
          "service": "NextDay"
        }
      ],
      "instructions": "Knock loudly",
      "min_datetime": "2018-01-01T12:00:00.000Z",
      "max_datetime": "2018-01-01T12:00:00.000Z",
      "purchase_started_at": "2018-01-01T12:00:00.000Z",
      "purchase_completed_at": "2018-01-01T12:00:00.000Z"
    },
    "relationships": {
      "shipment": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/relationships/shipment",
          "related": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/shipment"
        }
      },
      "parcels": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/relationships/parcels",
          "related": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/parcels"
        }
      },
      "events": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/relationships/events",
          "related": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/events"
        }
      },
      "event_stores": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/relationships/event_stores",
          "related": "https://yourdomain.commercelayer.io/api/easypost_pickups/XAyRWNUzyN/event_stores"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "xRRkjDFafe",
      "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
    }
  }
}
```

{% endtab %}
{% endtabs %}
