Delivery Lead Times

Delivery lead times provide customers with detailed information about their shipments. This is useful if you ship from many stock locations or offer more shipping method options within a market.

The delivery lead time object

A delivery lead time object is returned as part of the response body of each successful create, list, retrieve or update API call. The following table contains the list of all its fields along with their type, description and example values.
Object fields:
min_hours
integer
The delivery lead minimum time (in hours) when shipping from the associated stock location with the associated shipping method.
Example:
48
max_hours
integer
The delivery lead maximun time (in hours) when shipping from the associated stock location with the associated shipping method.
Example:
72
min_days
integer
The delivery lead minimum time, in days (rounded)
Example:
2
max_days
integer
The delivery lead maximun time, in days (rounded)
Example:
3
id
integer
Unique identifier for the resource.
Example:
1234
created_at
datetime
Time at which the resource was created.
Example:
2018-01-01T12:00:00.000Z
updated_at
datetime
Time at which the resource was last updated.
Example:
2018-01-01T12:00:00.000Z
reference
string
A string that you can use to add your own identifier to the resource. This can be useful for intergrating the resource to an external system, like an ERP, a marketing tool or a CRM.
Example:
ANYREFEFERNCE
metadata
object
Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
Example:
{"foo":"bar"}
relationship (N:1)
The associated stock location.
relationship (N:1)
The associated shipping method.

Create a delivery lead time

To create a new delivery lead time, send a POST request to the /api/delivery_lead_times endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.
Arguments:
min_hours
required
The delivery lead minimum time (in hours) when shipping from the associated stock location with the associated shipping method.
Example:
48
max_hours
required
The delivery lead maximun time (in hours) when shipping from the associated stock location with the associated shipping method.
Example:
72
reference
optional
A string that you can use to add your own identifier to the resource. This can be useful for intergrating the resource to an external system, like an ERP, a marketing tool or a CRM.
Example:
ANYREFEFERNCE
metadata
optional
Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
Example:
#
required
The associated stock location.
required
The associated shipping method.
Example request:
POST /api/delivery_lead_times HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "delivery_lead_times",
    "attributes": {
      "min_hours": "48",
      "max_hours": "72"
    },
    "relationships": {
      "stock_location": {
        "data": {
          "type": "stock_locations",
          "id": "1234"
        }
      },
      "shipping_method": {
        "data": {
          "type": "shipping_methods",
          "id": "1234"
        }
      }
    }
  }
}
Example response: 201 Created
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "1234",
    "type": "delivery_lead_times",
    "links": {
      "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234"
    },
    "attributes": {
      "min_hours": "48",
      "max_hours": "72",
      "min_days": "2",
      "max_days": "3",
      "id": "1234",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANYREFEFERNCE",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "stock_location": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/stock_location",
          "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/stock_location"
        }
      },
      "shipping_method": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/shipping_method",
          "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/shipping_method"
        }
      }
    },
    "meta": {
      "mode": "test"
    }
  }
}

List all delivery lead times

To fetch a collection of delivery lead times, send a GET request to the /api/delivery_lead_times endpoint.

Example request:
GET /api/delivery_lead_times HTTP/1.1
Accept: application/vnd.api+json
Example response: 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "data": [
    {
      "id": "1234",
      "type": "delivery_lead_times",
      "links": {
        "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234"
      },
      "attributes": {
        "min_hours": "48",
        "max_hours": "72",
        "min_days": "2",
        "max_days": "3",
        "id": "1234",
        "created_at": "2018-01-01T12:00:00.000Z",
        "updated_at": "2018-01-01T12:00:00.000Z",
        "reference": "ANYREFEFERNCE",
        "metadata": {
          "foo": "bar"
        }
      },
      "relationships": {
        "stock_location": {
          "links": {
            "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/stock_location",
            "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/stock_location"
          }
        },
        "shipping_method": {
          "links": {
            "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/shipping_method",
            "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/shipping_method"
          }
        }
      },
      "meta": {
        "mode": "test"
      }
    },
    {
      "other": "... 24 delivery_lead_times (first page)"
    }
  ],
  "meta": {
    "record_count": 125,
    "page_count": 5
  },
  "links": {
    "first": "/api/delivery_lead_times?page[number]=1&page[size]=25",
    "prev": "/api/delivery_lead_times?page[number]=2&page[size]=25",
    "next": "/api/delivery_lead_times?page[number]=4&page[size]=25",
    "last": "/api/delivery_lead_times?page[number]=5&page[size]=25"
  }
}
Available filters
idreferencestock_location_idshipping_method_ididscreated_at_fromcreated_at_toupdated_at_fromupdated_at_to
Sortable attributes
min_hoursmax_hoursidcreated_atupdated_atreference

Retrieve a delivery lead time

To fetch a single delivery lead time, send a GET request to the /api/delivery_lead_times/{{id}} endpoint, where {{id}} is the id of the resource that you want to retrieve.
Example request:
GET /api/delivery_lead_times/1234 HTTP/1.1
Accept: application/vnd.api+json
Example response: 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "1234",
    "type": "delivery_lead_times",
    "links": {
      "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234"
    },
    "attributes": {
      "min_hours": "48",
      "max_hours": "72",
      "min_days": "2",
      "max_days": "3",
      "id": "1234",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANYREFEFERNCE",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "stock_location": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/stock_location",
          "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/stock_location"
        }
      },
      "shipping_method": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/shipping_method",
          "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/shipping_method"
        }
      }
    },
    "meta": {
      "mode": "test"
    }
  }
}

Update a delivery lead time

To update an existing delivery lead time, send a PATCH request to the /api/delivery_lead_times/{{id}} endpoint, where {{id}} is the id of the resource that you want to update. The following table contains the list of all the possible arguments that you can pass with the request body, along with their type, description and examples values. Please note that all arguments are optional.
Arguments:
min_hours
optional
The delivery lead minimum time (in hours) when shipping from the associated stock location with the associated shipping method.
Example:
48
max_hours
optional
The delivery lead maximun time (in hours) when shipping from the associated stock location with the associated shipping method.
Example:
72
reference
optional
A string that you can use to add your own identifier to the resource. This can be useful for intergrating the resource to an external system, like an ERP, a marketing tool or a CRM.
Example:
ANYREFEFERNCE
metadata
optional
Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
Example:
#
optional
The associated stock location.
optional
The associated shipping method.
Example request:
PATCH /api/delivery_lead_times/1234 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "delivery_lead_times",
    "id": 1234,
    "attributes": {
      "min_hours": "48"
    },
    "relationships": {
    }
  }
}
Example response: 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "1234",
    "type": "delivery_lead_times",
    "links": {
      "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234"
    },
    "attributes": {
      "min_hours": "48",
      "max_hours": "72",
      "min_days": "2",
      "max_days": "3",
      "id": "1234",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANYREFEFERNCE",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "stock_location": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/stock_location",
          "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/stock_location"
        }
      },
      "shipping_method": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/relationships/shipping_method",
          "related": "https://your-brand.commercelayer.io/api/delivery_lead_times/1234/shipping_method"
        }
      }
    },
    "meta": {
      "mode": "test"
    }
  }
}

Delete a delivery lead time

To delete a delivery lead time, send a DELETE request to the /api/delivery_lead_times/{{id}} endpoint, where {{id}} is the id of the resource that you want to delete.
Example request:
DELETE /api/delivery_lead_times/1234 HTTP/1.1
Accept: application/vnd.api+json
Example response: 204 No Content
HTTP/1.1 204 No Content

Get our machine-readable JSON schema that follows the OpenAPI Specification (formerly Swagger).

Get our Postman collection in one click and start making real calls to Commerce Layer API in minutes.

Get in touch with our support team if you have any questions or want to learn more about Commerce Layer.