openapi: 3.1.0 info: title: EasyPost Shipping API description: | REST API for the EasyPost multi-carrier shipping platform. Covers shipments, rates, addresses, parcels, trackers, refunds and reports. Authentication is HTTP Basic with the API key as username and an empty password. This specification is a best-effort, documentation-derived description and may omit fields. version: 2.0.0 contact: name: EasyPost url: https://docs.easypost.com/ servers: - url: https://api.easypost.com/v2 description: Production security: - EasyPostBasic: [] paths: /shipments: post: summary: Create a shipment operationId: createShipment requestBody: required: true content: application/json: schema: type: object properties: shipment: $ref: '#/components/schemas/ShipmentInput' responses: '201': description: Shipment created content: application/json: schema: $ref: '#/components/schemas/Shipment' '401': $ref: '#/components/responses/Unauthorized' get: summary: List shipments operationId: listShipments parameters: - in: query name: page_size schema: type: integer - in: query name: before_id schema: type: string - in: query name: after_id schema: type: string responses: '200': description: A page of shipments content: application/json: schema: type: object properties: shipments: type: array items: $ref: '#/components/schemas/Shipment' /shipments/{id}: parameters: - $ref: '#/components/parameters/IdPath' get: summary: Retrieve a shipment operationId: getShipment responses: '200': description: Shipment content: application/json: schema: $ref: '#/components/schemas/Shipment' /shipments/{id}/buy: post: summary: Buy a shipment operationId: buyShipment parameters: - $ref: '#/components/parameters/IdPath' requestBody: required: true content: application/json: schema: type: object properties: rate: type: object properties: id: type: string insurance: type: string responses: '200': description: Purchased shipment with label content: application/json: schema: $ref: '#/components/schemas/Shipment' /shipments/{id}/label: get: summary: Convert a shipment label format operationId: convertShipmentLabel parameters: - $ref: '#/components/parameters/IdPath' - in: query name: file_format required: true schema: type: string enum: [pdf, zpl, epl2, png] responses: '200': description: Label conversion result content: application/json: schema: $ref: '#/components/schemas/Shipment' /shipments/{id}/refund: post: summary: Refund a shipment label operationId: refundShipment parameters: - $ref: '#/components/parameters/IdPath' responses: '200': description: Refund requested content: application/json: schema: $ref: '#/components/schemas/Shipment' /addresses: post: summary: Create an address operationId: createAddress requestBody: required: true content: application/json: schema: type: object properties: address: $ref: '#/components/schemas/Address' responses: '201': description: Address created content: application/json: schema: $ref: '#/components/schemas/Address' get: summary: List addresses operationId: listAddresses responses: '200': description: Addresses content: application/json: schema: type: object properties: addresses: type: array items: $ref: '#/components/schemas/Address' /addresses/{id}: parameters: - $ref: '#/components/parameters/IdPath' get: summary: Retrieve an address operationId: getAddress responses: '200': description: Address content: application/json: schema: $ref: '#/components/schemas/Address' /parcels: post: summary: Create a parcel operationId: createParcel requestBody: required: true content: application/json: schema: type: object properties: parcel: $ref: '#/components/schemas/Parcel' responses: '201': description: Parcel created content: application/json: schema: $ref: '#/components/schemas/Parcel' /trackers: post: summary: Create a tracker operationId: createTracker requestBody: required: true content: application/json: schema: type: object properties: tracker: type: object properties: tracking_code: type: string carrier: type: string responses: '201': description: Tracker created content: application/json: schema: $ref: '#/components/schemas/Tracker' get: summary: List trackers operationId: listTrackers responses: '200': description: Trackers content: application/json: schema: type: object properties: trackers: type: array items: $ref: '#/components/schemas/Tracker' /trackers/{id}: parameters: - $ref: '#/components/parameters/IdPath' get: summary: Retrieve a tracker operationId: getTracker responses: '200': description: Tracker content: application/json: schema: $ref: '#/components/schemas/Tracker' /refunds: post: summary: Create a refund operationId: createRefund requestBody: required: true content: application/json: schema: type: object properties: refund: type: object properties: carrier: type: string tracking_codes: type: array items: type: string responses: '201': description: Refund created /reports/{type}: post: summary: Create a report operationId: createReport parameters: - in: path name: type required: true schema: type: string enum: [shipment, tracker, refund, payment_log] requestBody: required: true content: application/json: schema: type: object properties: start_date: type: string format: date end_date: type: string format: date responses: '201': description: Report queued components: securitySchemes: EasyPostBasic: type: http scheme: basic description: HTTP Basic where username is your EasyPost API key and password is empty. parameters: IdPath: in: path name: id required: true schema: type: string responses: Unauthorized: description: Invalid API key content: application/json: schema: $ref: '#/components/schemas/Error' schemas: Address: type: object properties: id: type: string name: type: string company: type: string street1: type: string street2: type: string city: type: string state: type: string zip: type: string country: type: string phone: type: string email: type: string Parcel: type: object properties: id: type: string length: type: number width: type: number height: type: number weight: type: number predefined_package: type: string Rate: type: object properties: id: type: string service: type: string carrier: type: string rate: type: string currency: type: string delivery_days: type: integer ShipmentInput: type: object properties: to_address: $ref: '#/components/schemas/Address' from_address: $ref: '#/components/schemas/Address' parcel: $ref: '#/components/schemas/Parcel' carrier_accounts: type: array items: type: string Shipment: type: object properties: id: type: string to_address: $ref: '#/components/schemas/Address' from_address: $ref: '#/components/schemas/Address' parcel: $ref: '#/components/schemas/Parcel' rates: type: array items: $ref: '#/components/schemas/Rate' selected_rate: $ref: '#/components/schemas/Rate' tracking_code: type: string postage_label: type: object additionalProperties: true Tracker: type: object properties: id: type: string tracking_code: type: string status: type: string carrier: type: string tracking_details: type: array items: type: object additionalProperties: true Error: type: object properties: error: type: object properties: code: type: string message: type: string