{
  "openapi": "3.0.1",
  "info": {
    "title": "Importer of Record API",
    "description": "Manage **Importer of Record (IOR)** entries that represent legal entities responsible\nfor ensuring compliance of imported goods with local customs regulations, including\nfiling declarations and paying duties/taxes.\nThese APIs allow you to:\n- Create an Importer of Record definition with a unique code and associated country.\n- Retrieve an Importer of Record by its unique identifier.\n- Lookup and filter Importers of Record by metadata.\n- Update or partially update Importer of Record details.\n- Delete Importers of Record no longer in use.\n",
    "version": "1.0.0",
    "license": {
      "name": "PB Software License Agreement",
      "url": "https://www.pitneybowes.com/us/support/account/pitney-bowes-terms-and-conditions.html"
    }
  },
  "servers": [
    {
      "url": "https://api-sandbox.sendpro360.pitneybowes.com/shipping",
      "description": "Sandbox Server"
    },
    {
      "url": "https://api.sendpro360.pitneybowes.com/shipping",
      "description": "Production Server (uses live data)"
    },
    {
      "url": "https://api-ppd.shipping360.pitneybowes.com/ca/shipping",
      "description": "Sandbox Server for Canada"
    },
    {
      "url": "https://api.shipping360.pitneybowes.com/ca/shipping",
      "description": "Production Server for Canada"
    }
  ],
  "tags": [
    {
      "name": "Importer of Record"
    }
  ],
  "paths": {
    "/api/v1/importerofrecord": {
      "post": {
        "tags": [
          "Importer of Record"
        ],
        "summary": "Create Importer of Record",
        "description": "Creates a new Importer of Record entry for a specific country.  \nEach entry must have a unique `iorCode` and is tied to a `countryCode`.\n",
        "operationId": "createImporterOfRecord",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImporterOfRecordCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Importer of Record successfully created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImporterOfRecordCreated"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or Bad Request",
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "description": "Unauthorized Error",
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "500": {
            "description": "Internal Server Error",
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "get": {
        "tags": [
          "Importer of Record"
        ],
        "summary": "Get Importers of Record",
        "description": "Returns a list of Importers of Record.\n",
        "operationId": "getImportersOfRecord",
        "parameters": [
          {
            "in": "query",
            "name": "sort",
            "description": "Sort expression in the form `<field>,<direction>`.  \nSupported fields: `insertTimestamp`, `updateTimestamp`.  \nDirection: `ASC` or `DESC`.  \nExample: `insertTimestamp,DESC`\n",
            "schema": {
              "type": "string",
              "example": "insertTimestamp,DESC"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "A list of importers of record has beed retrived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ImporterOfRecordListItem"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or Bad Request",
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "description": "Unauthorized Error",
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "500": {
            "description": "Internal Server Error",
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/v1/importerofrecord/{id}": {
      "get": {
        "tags": [
          "Importer of Record"
        ],
        "summary": "Get Importer of Record by ID",
        "description": "Retrieves a specific Importer of Record entry by its unique `id`.\n",
        "operationId": "getImporterofRecordByID",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unique identifier of the Importer of Record entry."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Specified importer of record has beed retrived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImporterOfRecord"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or Bad Request",
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "description": "Unauthorized Error",
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "500": {
            "description": "Internal Server Error",
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "put": {
        "tags": [
          "Importer of Record"
        ],
        "summary": "Update Importer of Record",
        "description": "Update the Importer of Record entry with new values for `iorCode`,\n`description`, and `countryCode`.\n",
        "operationId": "updateImporterOfRecord",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unique identifier of the Importer of Record entry."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImporterOfRecordUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Importer of Record successfully updated."
          },
          "400": {
            "description": "Invalid or Bad Request",
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "description": "Unauthorized Error",
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "500": {
            "description": "Internal Server Error",
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "delete": {
        "tags": [
          "Importer of Record"
        ],
        "summary": "Detete Importer of Record",
        "description": "This operation deletes the Importer of Record entry identified by `id`.",
        "operationId": "deleteImporterofRecord",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unique identifier of the Importer of Record entry."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Specified Import of Record Code has beed deleted successfully."
          },
          "400": {
            "description": "Invalid or Bad Request",
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "description": "Unauthorized Error",
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "500": {
            "description": "Internal Server Error",
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "responses": {
      "UnauthorizedError": {
        "description": "The request could not be authorized.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "The request could not be completed due to an internal error.",
        "content": {}
      },
      "BadRequestError": {
        "description": "Invalid request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      }
    },
    "schemas": {
      "error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "This is HTTP 401 Unauthorized response status code, that indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource."
          }
        },
        "required": [
          "message"
        ]
      },
      "Errors": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "description": "List of errors.",
            "items": {
              "type": "object",
              "properties": {
                "errorCode": {
                  "type": "string",
                  "description": "This error can be validation_error or internal_error or not_found or already_exists",
                  "example": "validation_error"
                },
                "errorDescription": {
                  "type": "string",
                  "description": "The HTTP 400 Bad Request response status code indicates that the server cannot process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).",
                  "example": "Custom Fields not found"
                }
              }
            }
          }
        }
      },
      "ImporterOfRecordCreate": {
        "type": "object",
        "required": [
          "iorCode",
          "countryCode"
        ],
        "description": "Request body for creating an Importer of Record.",
        "properties": {
          "iorCode": {
            "type": "string",
            "description": "Unique code for the Importer of Record entry.",
            "example": "code28080001"
          },
          "description": {
            "type": "string",
            "description": "Human-readable description of the Importer of Record.",
            "example": "this is description for test codehashcode28080001"
          },
          "countryCode": {
            "type": "string",
            "description": "Two-letter ISO country code where this Importer of Record is registered.",
            "example": "US"
          }
        }
      },
      "ImporterOfRecordUpdate": {
        "type": "object",
        "description": "Request body for updating or partially updating an Importer of Record.",
        "properties": {
          "iorCode": {
            "type": "string",
            "description": "Updated code for the Importer of Record.",
            "example": "code28080001"
          },
          "description": {
            "type": "string",
            "description": "Updated description.",
            "example": "this is description for test codehashcode28080001-u1"
          },
          "countryCode": {
            "type": "string",
            "description": "Updated ISO country code.",
            "example": "IN"
          }
        }
      },
      "ImporterOfRecordCreated": {
        "type": "object",
        "description": "Response returned after creating an Importer of Record.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique system identifier of the created entry.",
            "example": "68afedcf556ad316aa50ccc7"
          }
        }
      },
      "ImporterOfRecord": {
        "type": "object",
        "description": "Complete Importer of Record object.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the Importer of Record.",
            "example": "68afedcf556ad316aa50ccc7"
          },
          "iorCode": {
            "type": "string",
            "description": "Code assigned to the Importer of Record.",
            "example": "code28080001"
          },
          "description": {
            "type": "string",
            "description": "Description of the Importer of Record Code.",
            "example": "this is description for test codehashcode28080001"
          },
          "countryCode": {
            "type": "string",
            "description": "Two-letter ISO country code where this Importer of Record is registered.",
            "example": "US"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the Importer of Record is archived.",
            "example": false
          }
        }
      },
      "ImporterOfRecordListItem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ImporterOfRecord"
          }
        ],
        "description": "Entry returned in lookup results."
      }
    }
  }
}