Skip to content

Create policy

Request

This endpoint creates a policy.

Security
Bearer
Path
companyIdstring, (uuid)required

Identifier for company.

Example:4974a66b-7493-4f41-908c-58ba81093947
Bodyapplication/jsonrequired
namestringrequired

Name of the policy.

typestring(PolicyType)required

Policy type.

Enum:"DEFAULT""GROUP""INTERNAL"
Example:"GROUP"
parentPolicyIdstring, (uuid)

Policy to inherit the values of linked rules. If empty, consider the company default policy.

Example:"f7b3b3b3-7b3b-4b3b-8b3b-3b3b3b3b3b3b"
currencyCurrencyCodeWrapper (object) or IsLinkedWrapper (object)(PolicyCurrency)required
One of:

Currency for the policy.

inPolicyApprovalInfosArray of objects(PolicyApprovalInfo)
outOfPolicyApprovalInfosArray of objects(PolicyApprovalInfo)
outOfPolicyAgentApprovalInfosArray of objects(PolicyApprovalInfo)
enableAgentActionOverrideboolean

True if agent can override the PREVENT_BOOKING action. If enabled, outOfPolicyAgentApprovalInfos for all travel types should be provided.

userGroupsArray of objects(UserGroup)required
commonPolicyRulesobject(CommonPolicyRules)

Details of policy that is common to all travel type.

carPolicyRulesobject(CarPolicyRules)

Details of rules related to car.

hotelPolicyRulesobject(HotelPolicyRules)

Details of rules related to hotel.

airPolicyRulesobject(AirPolicyRules)

Details of rules related to air.

rulesArray of objects(UniversalRule)

A list of general policy rules for all travel types air, hotel, car and rail.

airOopReasonCodesOopReasonCodesPropsWrapper (object) or IsLinkedWrapper (object)(OopReasonCodes)
One of:

Out of policy reason code question to be asked to user for air booking.

hotelOopReasonCodesOopReasonCodesPropsWrapper (object) or IsLinkedWrapper (object)(OopReasonCodes)
One of:

Out of policy reason code question to be asked to user for hotel booking.

carOopReasonCodesOopReasonCodesPropsWrapper (object) or IsLinkedWrapper (object)(OopReasonCodes)
One of:

Out of policy reason code question to be asked to user for car booking.

railOopReasonCodesOopReasonCodesPropsWrapper (object) or IsLinkedWrapper (object)(OopReasonCodes)
One of:

Out of policy reason code question to be asked to user for rail booking.

categorystring(PolicyCategory)

Category of the policy.

Default:"EMPLOYEE"
Enum:"EMPLOYEE""GUEST"
Example:"EMPLOYEE"
inPolicyApprovalInfoobject(PolicyApprovalInfo)deprecated
outOfPolicyApprovalInfoobject(PolicyApprovalInfo)deprecated
isRestrictivebooleandeprecated

True if policy is a restrictive policy.

Example:true
curl -i -X POST \
  https://api-ext-sboxmeta.partners.spotnana.com/v2/companies/4974a66b-7493-4f41-908c-58ba81093947/policies \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string",
    "type": "GROUP",
    "parentPolicyId": "f7b3b3b3-7b3b-4b3b-8b3b-3b3b3b3b3b3b",
    "currency": {
      "currencyCode": "USD"
    },
    "inPolicyApprovalInfo": {
      "approvalProcessType": "NONE",
      "designatedApprovers": [
        {
          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        }
      ],
      "isManagerApprover": false,
      "isEmployeeLevelDesignatedApprover": false,
      "shouldNotifyManager": false,
      "travelTypes": [
        "AIR"
      ],
      "approvalConditions": [
        {
          "rules": [
            {
              "travelRegionRule": {
                "travelRegionType": "DOMESTIC"
              }
            }
          ]
        }
      ],
      "defaultApprovers": [
        {
          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        }
      ]
    },
    "outOfPolicyApprovalInfo": {
      "approvalProcessType": "NONE",
      "designatedApprovers": [
        {
          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        }
      ],
      "isManagerApprover": false,
      "isEmployeeLevelDesignatedApprover": false,
      "shouldNotifyManager": false,
      "travelTypes": [
        "AIR"
      ],
      "approvalConditions": [
        {
          "rules": [
            {
              "travelRegionRule": {
                "travelRegionType": "DOMESTIC"
              }
            }
          ]
        }
      ],
      "defaultApprovers": [
        {
          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        }
      ]
    },
    "inPolicyApprovalInfos": [
      {
        "approvalProcessType": "NONE",
        "designatedApprovers": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ],
        "isManagerApprover": false,
        "isEmployeeLevelDesignatedApprover": false,
        "shouldNotifyManager": false,
        "travelTypes": [
          "AIR"
        ],
        "approvalConditions": [
          {
            "rules": [
              {
                "travelRegionRule": {}
              }
            ]
          }
        ],
        "defaultApprovers": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ]
      }
    ],
    "outOfPolicyApprovalInfos": [
      {
        "approvalProcessType": "NONE",
        "designatedApprovers": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ],
        "isManagerApprover": false,
        "isEmployeeLevelDesignatedApprover": false,
        "shouldNotifyManager": false,
        "travelTypes": [
          "AIR"
        ],
        "approvalConditions": [
          {
            "rules": [
              {
                "travelRegionRule": {}
              }
            ]
          }
        ],
        "defaultApprovers": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ]
      }
    ],
    "outOfPolicyAgentApprovalInfos": [
      {
        "approvalProcessType": "NONE",
        "designatedApprovers": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ],
        "isManagerApprover": false,
        "isEmployeeLevelDesignatedApprover": false,
        "shouldNotifyManager": false,
        "travelTypes": [
          "AIR"
        ],
        "approvalConditions": [
          {
            "rules": [
              {
                "travelRegionRule": {}
              }
            ]
          }
        ],
        "defaultApprovers": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ]
      }
    ],
    "enableAgentActionOverride": true,
    "userGroups": [
      {
        "userIds": [
          {
            "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          }
        ],
        "legalEntityIds": [
          {
            "id": "b93dc51f-12dd-46c7-b7d6-1cb12cd3f5b3"
          }
        ],
        "officeIds": [
          {
            "id": "b93dc51f-12dd-46c7-b7d6-1cb12cd3f5b3"
          }
        ],
        "departments": [
          "string"
        ],
        "costCenters": [
          "string"
        ],
        "grades": [
          "string"
        ],
        "positionTitles": [
          "string"
        ],
        "personas": [
          "EMPLOYEE"
        ],
        "customFieldIds": [
          {
            "type": "QUESTION",
            "externalId": "string"
          }
        ],
        "countryCodes": [
          "GB"
        ],
        "workerTypes": [
          "EMPLOYEE"
        ],
        "accountingCodes": [
          "string"
        ]
      }
    ],
    "commonPolicyRules": {
      "restrictedContinents": {
        "isLinked": true
      },
      "restrictedCountries": {
        "isLinked": true
      }
    },
    "carPolicyRules": {
      "maxCarPricePerNumberOfDays": {
        "isLinked": true
      },
      "allowedCarTypes": {
        "isLinked": true
      }
    },
    "hotelPolicyRules": {
      "restrictedHotels": {
        "isLinked": true
      },
      "maxHotelPriceByLocation": {
        "isLinked": true
      },
      "hotelAdvanceBookingWindow": {
        "isLinked": true
      },
      "hotelCancellation": {
        "isLinked": true
      },
      "hotelChainCodes": {
        "isLinked": true
      },
      "hotelStarRating": {
        "isLinked": true
      },
      "hotelMedianRateNightly": {
        "isLinked": true
      },
      "hotelCentralTierExemption": {
        "isLinked": true
      }
    },
    "airPolicyRules": {
      "restrictedAirlines": {
        "isLinked": true
      },
      "restrictedAirCrafts": {
        "isLinked": true
      },
      "maxFlightBookingPriceByDuration": {
        "isLinked": true
      },
      "flightCabinUpgrade": {
        "isLinked": true
      },
      "flightAdvanceBookingWindow": {
        "isLinked": true
      },
      "flightTicketsRefundable": {
        "isLinked": true
      },
      "flightTicketsChangeable": {
        "isLinked": true
      },
      "highestFlightCabinByDurationDomestic": {
        "isLinked": true
      },
      "highestFlightCabinByDurationInternational": {
        "isLinked": true
      },
      "highestFlightCabinOvernight": {
        "isLinked": true
      },
      "differenceBetweenFlightFareAndMedianFare": {
        "isLinked": true
      },
      "co2EmissionPerPassengerPerKm": {
        "isLinked": true
      },
      "maxFlightBookingPriceInternational": {
        "isLinked": true
      },
      "maxFlightBookingPriceDomestic": {
        "isLinked": true
      },
      "lowestLogicalFare": {
        "isLinked": true
      }
    },
    "isRestrictive": true,
    "rules": [
      {
        "ruleType": "CAR_TYPES_NOT_ALLOWED",
        "action": {
          "preventBooking": {
            "prevent": false,
            "reason": "string"
          }
        },
        "policyValue": {
          "isLinked": true
        }
      }
    ],
    "airOopReasonCodes": {
      "props": {
        "reasonCodes": [
          {
            "entityId": "string",
            "displayInfo": "string",
            "questionFormat": "CHECKBOX",
            "options": [
              {
                "displayCode": "string",
                "displayValue": "string"
              }
            ],
            "isRequired": true,
            "isDisabled": true
          }
        ]
      }
    },
    "hotelOopReasonCodes": {
      "props": {
        "reasonCodes": [
          {
            "entityId": "string",
            "displayInfo": "string",
            "questionFormat": "CHECKBOX",
            "options": [
              {
                "displayCode": "string",
                "displayValue": "string"
              }
            ],
            "isRequired": true,
            "isDisabled": true
          }
        ]
      }
    },
    "carOopReasonCodes": {
      "props": {
        "reasonCodes": [
          {
            "entityId": "string",
            "displayInfo": "string",
            "questionFormat": "CHECKBOX",
            "options": [
              {
                "displayCode": "string",
                "displayValue": "string"
              }
            ],
            "isRequired": true,
            "isDisabled": true
          }
        ]
      }
    },
    "railOopReasonCodes": {
      "props": {
        "reasonCodes": [
          {
            "entityId": "string",
            "displayInfo": "string",
            "questionFormat": "CHECKBOX",
            "options": [
              {
                "displayCode": "string",
                "displayValue": "string"
              }
            ],
            "isRequired": true,
            "isDisabled": true
          }
        ]
      }
    },
    "category": "EMPLOYEE"
  }'

Responses

Created

Bodyapplication/json
idstring, (uuid)required
Example:"b93dc51f-12dd-46c7-b7d6-1cb12cd3f5b3"
Response
{ "id": "b93dc51f-12dd-46c7-b7d6-1cb12cd3f5b3" }