Manage Autopilot repository links

Link a Space to a repository so Autopilot can propose documentation changes. The account must manage the Space; mutations require Enterprise entitlement and the relevant provider connection/permissions.

{
    "title": "List repository links",
    "description": "",
    "method": "GET",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/links",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Link resources under data and meta.capabilities.auto_apply. Requires eligible preview access and Space management permission. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"data\": [\n    {\n      \"id\": 789,\n      \"space_id\": 123,\n      \"provider\": \"github\",\n      \"repository_identifier\": \"example/payments\",\n      \"branch\": \"main\",\n      \"trigger_events\": [\n        \"push\"\n      ],\n      \"enabled\": true,\n      \"auto_apply_enabled\": false,\n      \"auto_apply_effective_enabled\": false,\n      \"auto_apply_threshold_pct\": 95,\n      \"webhook_state\": \"active\"\n    }\n  ]\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
{
    "title": "Create a repository link",
    "description": "",
    "method": "POST",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/links",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        },
        {
            "key": "Content-Type",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "json",
    "requestBody": "{\n  \"provider\": \"github\",\n  \"repository_identifier\": \"example/payments\",\n  \"branch\": \"main\",\n  \"trigger_events\": [\n    \"push\",\n    \"pr_merge\"\n  ],\n  \"path_filters\": null,\n  \"ai_context_instructions\": null,\n  \"notify_on_new_suggestions\": true,\n  \"notification_channels_input\": {},\n  \"auto_apply_enabled\": false,\n  \"auto_apply_threshold_pct\": 95\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "201": {
            "description": "Created repository-link resource under data, including effective mode and webhook state. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"data\": {\n    \"id\": 789,\n    \"space_id\": 123,\n    \"provider\": \"github\",\n    \"repository_identifier\": \"example/payments\",\n    \"branch\": \"main\",\n    \"trigger_events\": [\n      \"push\"\n    ],\n    \"enabled\": true,\n    \"auto_apply_enabled\": false,\n    \"auto_apply_effective_enabled\": false,\n    \"auto_apply_threshold_pct\": 95,\n    \"webhook_state\": \"active\"\n  }\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
{
    "title": "Update a repository link",
    "description": "",
    "method": "PATCH",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/links/{link}",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        },
        {
            "key": "Content-Type",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        },
        {
            "key": "link",
            "value": "Numeric repository-link ID belonging to the Space.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "json",
    "requestBody": "{\n  \"branch\": \"main\",\n  \"auto_apply_enabled\": false\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Updated link resource under data. Invalid or unavailable settings return 422. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"data\": {\n    \"id\": 789,\n    \"space_id\": 123,\n    \"provider\": \"github\",\n    \"repository_identifier\": \"example/payments\",\n    \"branch\": \"main\",\n    \"trigger_events\": [\n      \"push\"\n    ],\n    \"enabled\": true,\n    \"auto_apply_enabled\": false,\n    \"auto_apply_effective_enabled\": false,\n    \"auto_apply_threshold_pct\": 95,\n    \"webhook_state\": \"active\"\n  }\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
{
    "title": "Delete a repository link",
    "description": "",
    "method": "DELETE",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/links/{link}",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        },
        {
            "key": "link",
            "value": "Numeric repository-link ID belonging to the Space.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "204": {
            "description": "No body when immediate deletion succeeds. Other outcomes: 202 webhook_cleanup_pending, 409 webhook_cleanup_reauth_required, or 422 webhook_cleanup_failed.",
            "body": ""
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
{
    "title": "Enable a repository link",
    "description": "",
    "method": "POST",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/links/{link}/enable",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        },
        {
            "key": "link",
            "value": "Numeric repository-link ID belonging to the Space.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Updated link resource with enabled/effective/webhook state. Provider access and Enterprise entitlement are required. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"data\": {\n    \"id\": 789,\n    \"space_id\": 123,\n    \"provider\": \"github\",\n    \"repository_identifier\": \"example/payments\",\n    \"branch\": \"main\",\n    \"trigger_events\": [\n      \"push\"\n    ],\n    \"enabled\": true,\n    \"auto_apply_enabled\": false,\n    \"auto_apply_effective_enabled\": false,\n    \"auto_apply_threshold_pct\": 95,\n    \"webhook_state\": \"active\"\n  }\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
{
    "title": "Disable a repository link",
    "description": "",
    "method": "POST",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/links/{link}/disable",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        },
        {
            "key": "link",
            "value": "Numeric repository-link ID belonging to the Space.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Updated link state when completed. Provider cleanup may return pending or reauthorization/error state; inspect the result. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"data\": {\n    \"id\": 789,\n    \"space_id\": 123,\n    \"provider\": \"github\",\n    \"repository_identifier\": \"example/payments\",\n    \"branch\": \"main\",\n    \"trigger_events\": [\n      \"push\"\n    ],\n    \"enabled\": false,\n    \"auto_apply_enabled\": false,\n    \"auto_apply_effective_enabled\": false,\n    \"auto_apply_threshold_pct\": 95,\n    \"webhook_state\": \"inactive\"\n  }\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
{
    "title": "List provider repositories",
    "description": "",
    "method": "GET",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/autopilot/spaces/{space}/providers/{provider}/repositories",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        },
        {
            "key": "provider",
            "value": "One of github, gitlab, bitbucket or azure.",
            "type": "string",
            "required": true
        }
    ],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Provider repository choices and connection/webhook-permission state. disconnected responses can include reauth_url; upstream failures return 502. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"data\": [\n    {\n      \"id\": \"example/payments\",\n      \"label\": \"example/payments\"\n    }\n  ],\n  \"connected\": true,\n  \"has_webhook_permissions\": true\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}
  • The request example shows required fields; path_filters and ai_context_instructions, which are nullable strings up to 5,000 characters. provider must be github, gitlab, bitbucket or azure; repository identifier and branch are strings up to 255 characters. trigger_events is a non-empty array of push and/or pr_merge. auto_apply_threshold_pct must be 95–100, including when auto-apply is disabled.
  • notification_channels_input accepts channel enable booleans and HTTPS webhook URLs for Slack, Teams, Google Chat and custom webhooks.
  • Custom webhook secrets are strings up to 255 characters.
  • URLs must pass public-destination validation.
  • Start with manual review and add notifications after validating the connection.

Response and lifecycle

  • Create returns HTTP 201 with a link resource under data; list also includes meta.capabilities.auto_apply.
  • The resource reports id, space_id, provider/repository/branch, triggers, settings, enabled, auto_apply_enabled, auto_apply_effective_enabled, auto_apply_availability, effective_mode, and webhook_state.
  • PATCH accepts settings such as branch, triggers, filters, notification input and auto-apply options; it does not change the provider or repository identifier.
  • Auto-apply can be rejected with 422 and code: auto_apply_unavailable.
  • Provider connection failures and webhook cleanup can require reconnection or later completion: inspect returned state/code rather than treating every accepted request as completed provider cleanup.
  • Successful immediate DELETE returns 204.
  • Provider discovery can return connected: false and reauth_url, or has_webhook_permissions: false; reconnect using the product before retrying.
  • Upstream listing failures return 502.
  • GET links supports eligible preview access, while provider discovery and mutations are Enterprise-gated.
  • Cleanup responses distinguish HTTP 202 (webhook_cleanup_pending), 409 (webhook_cleanup_reauth_required), and 422 (webhook_cleanup_failed).
  • Reconnect when requested, and re-read the link state before assuming it has been removed.

API authentication.

Updated