{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shipcloud/json-schema/shipcloud-pickup-schema.json",
  "title": "pickup",
  "description": "for some carriers a pickup has to be requested when creating a shipment",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shipcloud-pickup-requests-api-openapi.yml#/components/schemas/pickup",
  "type": "object",
  "properties": {
    "pickup_time": {
      "$ref": "#/$defs/pickup_time_object"
    },
    "pickup_address": {
      "$ref": "#/$defs/address_with_id"
    }
  },
  "$defs": {
    "address": {
      "type": "object",
      "properties": {
        "care_of": {
          "type": [
            "string",
            "null"
          ],
          "description": "Additional care of field"
        },
        "city": {
          "type": "string",
          "description": "Name of the city"
        },
        "country": {
          "type": "string",
          "description": "Country as uppercase ISO 3166-1 alpha-2 code"
        },
        "first_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "A persons first name"
        },
        "state": {
          "type": [
            "string",
            "null"
          ],
          "description": "The state the address is in"
        },
        "street": {
          "type": "string",
          "description": "Name of the street. Can hold the house number"
        },
        "street_no": {
          "type": [
            "string",
            "null"
          ],
          "description": "House number of the address (when a carrier requires it separately)"
        },
        "zip_code": {
          "type": "string",
          "description": "Zipcode of the address"
        },
        "phone": {
          "type": "string",
          "description": "Telephone number (mandatory when using UPS and the following terms apply: service is `one_day` or `one_day_early` or ship to country is different than ship from country)"
        },
        "email": {
          "type": "string",
          "description": "Email address for this person. Some carrier are using the email address to send notifications"
        }
      },
      "required": [
        "street",
        "city",
        "zip_code",
        "country"
      ]
    },
    "address_with_id": {
      "allOf": [
        {
          "$ref": "#/$defs/address"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "identifier of a previously created address"
            }
          },
          "required": [
            "id",
            "first_name",
            "last_name",
            "company",
            "care_of",
            "state",
            "street_no"
          ]
        }
      ]
    },
    "pickup_time_object": {
      "type": "object",
      "properties": {
        "earliest": {
          "type": "string",
          "format": "date-time",
          "description": "Earliest pickup date and time"
        },
        "latest": {
          "type": "string",
          "format": "date-time",
          "description": "Latest pickup date and time"
        }
      },
      "description": "defines a time window in which the carrier should pickup shipments",
      "required": [
        "earliest",
        "latest"
      ]
    }
  }
}