[[update-connector-scheduling-api]]
=== Update connector scheduling API
++++
<titleabbrev>Update connector scheduling</titleabbrev>
++++

beta::[]

..New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-connector[Connector APIs].
--

Updates the `scheduling` configuration of a connector.

To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.


[[update-connector-scheduling-api-request]]
==== {api-request-title}

`PUT _connector/<connector_id>/_scheduling`

[[update-connector-scheduling-api-prereq]]
==== {api-prereq-title}

* To sync data using self-managed connectors, you need to deploy the <<es-connectors-deploy-connector-service,Elastic connector service>>. on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors.
* The `connector_id` parameter should reference an existing connector.

[[update-connector-scheduling-api-path-params]]
==== {api-path-parms-title}

`<connector_id>`::
(Required, string)

[role="child_attributes"]
[[update-connector-scheduling-api-request-body]]
==== {api-request-body-title}

`scheduling`::
(Required, object) The scheduling configuration for the connector. This configuration determines frequency of synchronization operations for the connector.

The scheduling configuration includes the following attributes, each represented as a `ScheduleConfig` object. If the `scheduling` object does not include all schedule types, only those provided will be updated; the others will remain unchanged.

- `access_control` (Optional, `ScheduleConfig` object) Defines the schedule for synchronizing access control settings of the connector.

- `full` (Optional, `ScheduleConfig` object) Defines the schedule for a full content syncs.

- `incremental` (Optional, `ScheduleConfig` object) Defines the schedule for incremental content syncs.

Each `ScheduleConfig` object includes the following sub-attributes:

  - `enabled` (Required, boolean) A flag that enables or disables the scheduling.

  - `interval` (Required, string) A CRON expression representing the sync schedule. This expression defines the grequency at which the sync operations should occur. It must be provided in a valid CRON format.


[[update-connector-scheduling-api-response-codes]]
==== {api-response-codes-title}

`200`::
Connector `scheduling` field was successfully updated.

`400`::
The `connector_id` was not provided or the request payload was malformed.

`404` (Missing resources)::
No connector matching `connector_id` could be found.

[[update-connector-scheduling-api-example]]
==== {api-examples-title}

The following example updates the `scheduling` property for the connector with ID `my-connector`:

////
[source, console]
--------------------------------------------------
PUT _connector/my-connector
{
  "index_name": "search-google-drive",
  "name": "My Connector",
  "service_type": "google_drive"
}
--------------------------------------------------
// TESTSETUP

[source,console]
--------------------------------------------------
DELETE _connector/my-connector
--------------------------------------------------
// TEARDOWN
////

[source,console]
----
PUT _connector/my-connector/_scheduling
{
    "scheduling": {
        "access_control": {
            "enabled": true,
            "interval": "0 10 0 * * ?"
        },
        "full": {
            "enabled": true,
            "interval": "0 20 0 * * ?"
        },
        "incremental": {
            "enabled": false,
            "interval": "0 30 0 * * ?"
        }
    }
}
----

[source,console-result]
----
{
    "result": "updated"
}
----

The following example updates `full` sync schedule only, other schedule types remain unchanged:

[source,console]
----
PUT _connector/my-connector/_scheduling
{
    "scheduling": {
        "full": {
            "enabled": true,
            "interval": "0 10 0 * * ?"
        }
    }
}
----

[source,console-result]
----
{
    "result": "updated"
}
----
