{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/artashippinginc/json-schema/artashippinginc-self-ship-collection-create-schema.json",
  "title": "SelfShipCollectionCreate",
  "description": "The payload for scheduling a self-ship collection. The expected shape depends on `service.carrier`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/artashippinginc-self-ship-collections-api-openapi.yml#/components/schemas/SelfShipCollectionCreate",
  "oneOf": [
    {
      "$ref": "#/$defs/FedexSelfShipCollectionPayload"
    },
    {
      "$ref": "#/$defs/DhlSelfShipCollectionPayload"
    }
  ],
  "x-struct": "Elixir.DocsWeb.Schemas.RequestBody.SelfShipCollectionCreate",
  "x-validate": null,
  "$defs": {
    "DhlSelfShipCollectionPayload": {
      "additionalProperties": false,
      "description": "Schedule a DHL collection",
      "properties": {
        "self_ship_collection": {
          "properties": {
            "collection_date": {
              "description": "Pickup date in ISO 8601 format (`YYYY-MM-DD`). Must be in the future.",
              "format": "date",
              "type": "string",
              "x-struct": null,
              "x-validate": null
            },
            "collection_time": {
              "description": "Pickup time in ISO 8601 format (`HH:MM:SS`). Must be before `location.close_time`.",
              "type": "string",
              "x-struct": null,
              "x-validate": null
            },
            "location": {
              "description": "Pickup location details",
              "properties": {
                "address_line_1": {
                  "description": "Street address",
                  "minLength": 1,
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "address_line_2": {
                  "description": "Additional address info",
                  "type": [
                    "string",
                    "null"
                  ],
                  "x-struct": null,
                  "x-validate": null
                },
                "city": {
                  "description": "City",
                  "minLength": 1,
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "close_time": {
                  "description": "Location closing time in ISO 8601 format (`HH:MM:SS`). Must be at least 3 hours after `collection_time`.",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "contact": {
                  "description": "Contact at the pickup location",
                  "properties": {
                    "email_address": {
                      "description": "Contact email address",
                      "type": [
                        "string",
                        "null"
                      ],
                      "x-struct": null,
                      "x-validate": null
                    },
                    "name": {
                      "description": "Contact name",
                      "type": "string",
                      "x-struct": null,
                      "x-validate": null
                    },
                    "phone_number": {
                      "description": "Contact phone number",
                      "type": "string",
                      "x-struct": null,
                      "x-validate": null
                    }
                  },
                  "required": [
                    "name",
                    "phone_number"
                  ],
                  "type": "object",
                  "x-struct": null,
                  "x-validate": null
                },
                "country": {
                  "description": "Two-letter country code. Currently `US` and `GB` are supported.",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "postal_code": {
                  "description": "Postal code",
                  "minLength": 1,
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "region": {
                  "description": "State or territory code. Required for `US` addresses and must be a valid US state or territory code; may be an empty string for `GB` addresses.",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                }
              },
              "required": [
                "address_line_1",
                "city",
                "country",
                "region",
                "postal_code",
                "close_time",
                "contact"
              ],
              "type": "object",
              "x-struct": null,
              "x-validate": null
            },
            "service": {
              "description": "Carrier service details",
              "properties": {
                "carrier": {
                  "description": "Carrier identifier",
                  "enum": [
                    "dhl"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "code": {
                  "description": "Service level code. Must be `express`.",
                  "enum": [
                    "express"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "declared_value": {
                  "description": "Declared value of the collected packages, as a decimal string. Required when `route` is `international`; optional for `domestic` collections. Must be provided together with `declared_value_currency`.",
                  "pattern": "^(0|([1-9]+[0-9]*))(\\.[0-9]{1,2})?$",
                  "title": "MonetaryAmount",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "declared_value_currency": {
                  "description": "ISO 4217 three-letter currency code for `declared_value`. Options are defined in the [Currencies metadata endpoint](https://api-reference.arta.io/operation/operation-metadata-currencies). Required whenever `declared_value` is provided.",
                  "maxLength": 3,
                  "minLength": 3,
                  "pattern": "^[A-Z]{3}$",
                  "title": "Currency",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "package_details": {
                  "description": "The packages to be collected, one entry per package. All packages must share the same units, and the unit pair must be either `in` + `lb` or `cm` + `kg`.",
                  "properties": {
                    "packages": {
                      "description": "The packages included in the collection. Must contain at least one package. Dimensions and weight are numeric strings (for example `\"12\"` or `\"12.5\"`), following the same convention as `request.objects`; a value that cannot be parsed as a number is rejected with a `422`.",
                      "items": {
                        "properties": {
                          "depth": {
                            "description": "Package depth",
                            "type": "string",
                            "x-struct": null,
                            "x-validate": null
                          },
                          "height": {
                            "description": "Package height",
                            "type": "string",
                            "x-struct": null,
                            "x-validate": null
                          },
                          "unit_of_measurement": {
                            "description": "Unit for `depth`, `height`, and `width`. Must be `in` when `weight_unit` is `lb`, or `cm` when `weight_unit` is `kg`.",
                            "enum": [
                              "in",
                              "cm"
                            ],
                            "type": "string",
                            "x-struct": null,
                            "x-validate": null
                          },
                          "weight": {
                            "description": "Package weight",
                            "type": "string",
                            "x-struct": null,
                            "x-validate": null
                          },
                          "weight_unit": {
                            "description": "Unit for `weight`. Must be `lb` when `unit_of_measurement` is `in`, or `kg` when it is `cm`.",
                            "enum": [
                              "lb",
                              "kg"
                            ],
                            "type": "string",
                            "x-struct": null,
                            "x-validate": null
                          },
                          "width": {
                            "description": "Package width",
                            "type": "string",
                            "x-struct": null,
                            "x-validate": null
                          }
                        },
                        "required": [
                          "depth",
                          "height",
                          "width",
                          "unit_of_measurement",
                          "weight",
                          "weight_unit"
                        ],
                        "title": "DhlPackage",
                        "type": "object",
                        "x-struct": null,
                        "x-validate": null
                      },
                      "minItems": 1,
                      "type": "array",
                      "x-struct": null,
                      "x-validate": null
                    }
                  },
                  "required": [
                    "packages"
                  ],
                  "title": "DhlPackageDetails",
                  "type": "object",
                  "x-struct": null,
                  "x-validate": null
                },
                "route": {
                  "description": "Route type. `international` for cross-border collections, `domestic` otherwise. An `international` collection is subject to customs and requires `declared_value` and `declared_value_currency`.",
                  "enum": [
                    "domestic",
                    "international"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                }
              },
              "required": [
                "carrier",
                "code",
                "route",
                "package_details"
              ],
              "type": "object",
              "x-struct": null,
              "x-validate": null
            }
          },
          "required": [
            "location",
            "service",
            "collection_date",
            "collection_time"
          ],
          "type": "object",
          "x-struct": null,
          "x-validate": null
        }
      },
      "required": [
        "self_ship_collection"
      ],
      "title": "DhlSelfShipCollectionPayload",
      "type": "object",
      "x-struct": "Elixir.DocsWeb.Schemas.RequestBody.SelfShipCollectionCreateDhl",
      "x-validate": null
    },
    "FedexSelfShipCollectionPayload": {
      "additionalProperties": false,
      "description": "Schedule a FedEx collection",
      "properties": {
        "self_ship_collection": {
          "properties": {
            "collection_date": {
              "description": "Pickup date in ISO 8601 format (`YYYY-MM-DD`). Must be in the future.",
              "format": "date",
              "type": "string",
              "x-struct": null,
              "x-validate": null
            },
            "collection_time": {
              "description": "Pickup time in ISO 8601 format (`HH:MM:SS`). Must be before `location.close_time`.",
              "type": "string",
              "x-struct": null,
              "x-validate": null
            },
            "location": {
              "description": "Pickup location details",
              "properties": {
                "address_line_1": {
                  "description": "Street address",
                  "minLength": 1,
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "address_line_2": {
                  "description": "Additional address info",
                  "type": [
                    "string",
                    "null"
                  ],
                  "x-struct": null,
                  "x-validate": null
                },
                "city": {
                  "description": "City",
                  "minLength": 1,
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "close_time": {
                  "description": "Location closing time in ISO 8601 format (`HH:MM:SS`). Must be after `collection_time`.",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "contact": {
                  "description": "Contact at the pickup location",
                  "properties": {
                    "email_address": {
                      "description": "Contact email address",
                      "type": [
                        "string",
                        "null"
                      ],
                      "x-struct": null,
                      "x-validate": null
                    },
                    "name": {
                      "description": "Contact name",
                      "type": "string",
                      "x-struct": null,
                      "x-validate": null
                    },
                    "phone_number": {
                      "description": "Contact phone number",
                      "type": "string",
                      "x-struct": null,
                      "x-validate": null
                    }
                  },
                  "required": [
                    "name",
                    "phone_number"
                  ],
                  "type": "object",
                  "x-struct": null,
                  "x-validate": null
                },
                "country": {
                  "description": "Two-letter country code. Currently `US` and `GB` are supported.",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "package_location": {
                  "default": "none",
                  "description": "Where packages are located at the pickup location",
                  "enum": [
                    "front",
                    "none",
                    "rear",
                    "side"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "postal_code": {
                  "description": "Postal code",
                  "minLength": 1,
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "region": {
                  "description": "State or territory code. Required for `US` addresses and must be a valid US state or territory code; may be an empty string for `GB` addresses.",
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                }
              },
              "required": [
                "address_line_1",
                "city",
                "country",
                "region",
                "postal_code",
                "close_time",
                "contact"
              ],
              "type": "object",
              "x-struct": null,
              "x-validate": null
            },
            "service": {
              "description": "Carrier service details",
              "properties": {
                "carrier": {
                  "description": "Carrier identifier",
                  "enum": [
                    "fedex"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "code": {
                  "description": "Service level code. `ground` schedules a FedEx Ground collection; `express` schedules a FedEx Express collection.",
                  "enum": [
                    "express",
                    "ground"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                },
                "package_details": {
                  "description": "An optional summary of the packages to be collected, used for `express` collections. Provide `package_count`, `total_weight`, and `total_weight_unit` together; a partial summary, or one whose values cannot be parsed, is ignored rather than rejected.",
                  "properties": {
                    "package_count": {
                      "description": "Total number of packages in the collection",
                      "minimum": 0,
                      "type": "integer",
                      "x-struct": null,
                      "x-validate": null
                    },
                    "total_weight": {
                      "description": "Combined weight of all packages",
                      "type": "string",
                      "x-struct": null,
                      "x-validate": null
                    },
                    "total_weight_unit": {
                      "description": "Unit for `total_weight`",
                      "enum": [
                        "lb",
                        "kg"
                      ],
                      "type": "string",
                      "x-struct": null,
                      "x-validate": null
                    }
                  },
                  "title": "FedexPackageDetails",
                  "type": "object",
                  "x-struct": null,
                  "x-validate": null
                },
                "route": {
                  "description": "Route type. `international` for cross-border collections, `domestic` otherwise.",
                  "enum": [
                    "domestic",
                    "international"
                  ],
                  "type": "string",
                  "x-struct": null,
                  "x-validate": null
                }
              },
              "required": [
                "carrier",
                "code",
                "route"
              ],
              "type": "object",
              "x-struct": null,
              "x-validate": null
            }
          },
          "required": [
            "location",
            "service",
            "collection_date",
            "collection_time"
          ],
          "type": "object",
          "x-struct": null,
          "x-validate": null
        }
      },
      "required": [
        "self_ship_collection"
      ],
      "title": "FedexSelfShipCollectionPayload",
      "type": "object",
      "x-struct": "Elixir.DocsWeb.Schemas.RequestBody.SelfShipCollectionCreateFedex",
      "x-validate": null
    }
  }
}