Autotask API Reference

The Autotask API allows you to programmatically upload new code to any of your Autotasks.

Requests need to be authenticated with a bearer token, which is negotiated from the Team API Key with the corresponding capability. Refer to the authentication section for info on how to negotiate it.

We recommend you use the defender-autotask-client npm package for simplifying interactions with the Autotask API.

Update Code Endpoint

The autotasks/{id}/code endpoint is used for uploading new Autotask code via a PUT request. The endpoint accepts a JSON object with an encodedZippedCode property, which corresponds to the base64-encoded zip file with the code bundle.

zip -r index.js

curl \
  -X PUT \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "X-Api-Key: $KEY" \
  -H "Authorization: Bearer $TOKEN" \
  -d "{ \"encodedZippedCode\": \"$(cat | base64 -w0)\" }" \
You can include multiple files in the bundle, as long as the bundle does not exceed 50MB in size, and you include an index.js at the root of the zip file to act as entrypoint.