# Create Optimisation

Endpoint: POST /api/webhooks/ro/optimisation/v4/
Version: 1.0
Security: key

## Security:

  - `key` (unknown)
    apiKey in query key

## Request fields (application/json):

  - `type` (string)

  - `day` (string)
    Date in ISO-8601 YYYY-MM-DD.

  - `options` (object)

  - `options.order_ids` (array)

  - `options.external_ids` (array)

  - `options.member_ids` (array)

  - `options.working_hours` (object)

  - `options.working_hours.lower` (string)

  - `options.working_hours.upper` (string)

  - `options.service_time` (integer)

  - `options.pickup_service_time` (integer)

  - `options.start_place` (string)

  - `options.start_hub` (integer)

  - `options.end_place` (string)

  - `options.end_hub` (integer)

  - `options.re_optimise_assigned` (boolean)

  - `options.use_vehicle_capacity` (boolean)

  - `options.use_all_not_assigned_jobs` (boolean)

## Request examples:

  - `Request Body` (unknown)

## Response 201:

  - `201` (unknown)
    201

## Response 201 fields (application/json):

  - `id` (integer)
    Example: 32

  - `type` (string)
    Example: ADVANCED

  - `day` (string)
    Example: 2020-09-10

  - `merchant` (integer)
    Example: 180

  - `options` (object)

  - `options.start_place` (string)
    Example: default_hub

  - `options.start_hub` (any)

  - `options.end_place` (string)
    Example: default_hub

  - `options.end_hub` (any)

  - `options.order_ids` (array)

  - `options.external_ids` (array)

  - `options.member_ids` (array)

  - `options.working_hours` (object)

  - `options.working_hours.lower` (string)
    Example: 09:00

  - `options.working_hours.upper` (string)
    Example: 19:00

  - `options.re_optimise_assigned` (boolean)
    Example: false

  - `options.use_vehicle_capacity` (boolean)
    Example: false

  - `options.service_time` (integer)
    Example: 5

  - `routes` (array)

  - `state` (string)
    Example: VALIDATION

  - `task_status` (string)
    Example: in_progress

  - `group` (any)

  - `customers_notified` (boolean)
    Example: false

  - `log` (object)

  - `log.messages` (array)

  - `log.messages.text` (string)
    Example: Optimisation started

  - `log.messages.time` (string)
    Example: 2020-09-10T04:09:55.914803+11:00

  - `log.progress` (any)

  - `log.steps` (array)

## Response 400:

  - `400` (unknown)
    400

## Response 400 fields (application/json):

  - `detail` (string)
    Example: This field is required.

  - `errors` (object)

  - `errors.options` (object)

  - `errors.options.start_place` (array)

  - `errors.options.end_place` (array)

  - `errors.options.member_ids` (array)

  - `errors.options.working_hours` (array)

## Response 403:

  - `403` (unknown)
    403

## Response 403 fields (application/json):

  - `detail` (string)
    Example: Route optimisation is not active for you

  - `errors` (any)

## Response 201 examples:

  - `Result` (unknown)

## Response 400 examples:

  - `Required` (unknown)

  - `Driver` (unknown)

  - `Past Optimisation` (unknown)

  - `Order Expired` (unknown)

  - `Disabled` (unknown)

