# Create Defaults

While creating shipment, a few columns/ fields information are used mandatorily, and if the value for those columns are used repetitively, then it is always better to save last used values.
And hence, this API has been introduced. Using this API, default values can be set up for frequently used columns/fields information like carrier and linked services. 
Setting up the defaults will save both time and efforts.

Endpoint: POST /api/v1/defaults
Version: 1.0.0
Security: bearerAuth

## Request fields (application/json):

  - `name` (string)
    Name of the Default.
    Example: FedEx-Defaults

  - `defaultID` (string)
    A unique identifier to be assigned to the Default.
    Example: 0d4f3c51-059b-4c28-a83b-a8defa2962cc

  - `sendingOptions` (object)
    Sending Options will include carrier and its account details, sender details, and parcel details.

  - `sendingOptions.carrier` (string)
    Name of the carrier. E.g., FedEx.
    Enum: "FedEx", "USPS"

  - `sendingOptions.service` (string)
    Name of the carrier-based service. E.g., 2DA.
    Example: 2DA

  - `sendingOptions.carrierAccounts` (object)
    Name of the carrier account which is provided while adding carrier.
    Example: {"USPS":"JYKEb4VQvoVx!","FEDEX":"WRF4VFUUJDx!"}

  - `sendingOptions.carrierAccounts.key` (string)
    This is the key mapped with the name of the carrier.

  - `sendingOptions.carrierAccounts.value` (string)
    This is the value mapped with the CarrierAccount of the carrier.
    Example: null

  - `sendingOptions.labelSize` (string)
    Size of the label, e.g., DOC_4X6.
    Enum: "DOC_4X6"

  - `sendingOptions.labelType` (string)
    Type of the Label, e.g., Shipping_Label.
    Example: SHIPPING_LABEL

  - `sendingOptions.labelFormat` (string)
    Format of the Label, e.g., PDF.
    Example: PDF

  - `sendingOptions.fromAddress` (object)
    The complete address of the Sender.

  - `sendingOptions.fromAddress.name` (string, required)
    The name of the Sender to which this address points.
    Example: Sender Name

  - `sendingOptions.fromAddress.addressLine1` (string, required)
    The addressLine1 contains the Flat number, Building or Apartment Name/number (if any) or company name (if not residential) of the Sender.  `Max length = 35`.
    Example: 1600 Amphitheatre Parkway

  - `sendingOptions.fromAddress.addressLine2` (string)
    The addressLine2 contains Street address or Landmark (if any).
    Example: near abc street

  - `sendingOptions.fromAddress.addressLine3` (string)
    The addressLine3 contains P.O. Box (if any) near the address.
    Example: near xyz street

  - `sendingOptions.fromAddress.company` (string)
    The name of the company, in case if the senders address is not residential.
    Example: PB

  - `sendingOptions.fromAddress.email` (string)
    This must be senders's valid email. Email is required if the customer is using GoFor Carrier. Sender email is required for RMG b2b shipment.  `Max length = 50`
    Example: testuser@gmail.com

  - `sendingOptions.fromAddress.phone` (string, required)
    This is sender's phone number. Enter the digits with or without spaces or hyphens. The maximum limit of characters for Phone number are 10 digits.
    Example: 6502530000

  - `sendingOptions.fromAddress.cityTown` (string, required)
    The name of the city or town the Sender's address belongs to.  `Max length = 30`.
    Example: Mountain View

  - `sendingOptions.fromAddress.stateProvince` (string, required)
    "The name of the State or Province the Sender belongs to. It is the `2-letter` State or Province Code for US or Canadian address(es).
 Below is the hyperlink for CA country that will navigate to its Province/State Codes page. Similarly, respective country users can check for their country- State/Province codes.
 Please switch to the `Search` tab, select `Country codes` radio button, enter the required country name or country code, and then click `SEARCH` button.  `Max length = 2`"
    Example: CA

  - `sendingOptions.fromAddress.postalCode` (string, required)
    The Postal Code or ZIP Code of the address.  For CA addresses, use a `six-character` alphanumeric string Postal Code in this format: 'A1A 1A1'.  While for US addresses, use either the `5-digit` or `9-digit` ZIP Code in one of the following formats: '12345' or '12345-6789'.  `Max length = 10`
    Example: 94043

  - `sendingOptions.fromAddress.inductionPostalCode` (string)
    The postal code where the shipment is tendered to the carrier. If an induction postal code is specified in the "fromAddress", it will be used for rate calculations and determining manifest eligibility instead of the standard postal code. If not specified, the postal code from the "fromAddress" will be used.
    Example: 06905

  - `sendingOptions.fromAddress.countryCode` (string, required)
    "The country in which the sender's address is located. The value will be the two-character ISO Code of the country from the ISO country list.  Use ISO 3166-1 Alpha-2 standard values. For best results this should be included, especially if the country name does not appear in any of the unparsedAddressLines.
 Below is the hyperlink, please select `Country codes` and then click `SEARCH` button.  `Max length = 2`"
    Example: US

  - `sendingOptions.fromAddress.residential` (boolean)
    The specified address can be Residential or Official. In case if the address is Residential, the boolean value will be 'true', else it will take 'false'.
    Example: true

## Response 200 fields (application/json):

  - `id` (string)
    Unique identifier used in Database for Default, for mapping purpose.
    Example: 66b1b6d6a2c763f9d0bd5396

  - `defaultId` (string)
    Assigned unique identifier for the created Default.
    Example: 1c7937cf-fc56-4fc6-95bf-0465ae9acd4f

## Response 400 fields (application/json):

  - `errorCode` (string)
    Error code(s) that appear due to HTTP  400- Invalid or Bad Request, e.g., validation-error.
    Example: validation_error

  - `errorDescription` (string)
    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: string

  - `additionalCode` (string)
    A unique identifier for the error, for example 1101055, 0100008, or 1021126.

  - `additionalInfo` (string)
    This is an additional information about the error. This error 'Invalid Request' might appear due to invalid dimension, weight, or serviceID, or if the information is missing.

  - `additionalParameters` (array)

## Response 401 fields (application/json):

  - `message` (string, required)
    This is HTTP 401 Unauthorized response status code, which indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.

## Response 500 fields (application/json):

  - `message` (string, required)
    This is HTTP 500 Internal Server Error response status code, which indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

