---
title: "create operation"
method: POST
path: "/metric_drains/{metric_drain_id}/operations"
tags: ["Operations"]
---

# create operation

`POST /metric_drains/{metric_drain_id}/operations`

## Request

- Base URL: `https://api.aptible.com`
- URL: `https://api.aptible.com/metric_drains/{metric_drain_id}/operations`
- Auth: API key in header `Authorization`

Creates a new operation for the specified metric drain.

## Path parameters

- `metric_drain_id` integer, required

## Query parameters

- `no_embed` boolean

## Headers

- `Prefer` 'no_sensitive_extras=true'

## Request body

- CreateOperationRequest
  - `type` string, required
  - `git_ref` string
  - `disk_size` integer
  - `container_count` integer
  - `container_size` integer
  - `command` string
  - `env` object
  - `handle` string
  - `certificate` string
  - `private_key` string
  - `destination_region` string
  - `interactive` boolean
  - `destination_account` string, uri
  - `destination_account_id` integer
  - `deploy_image_id` integer
  - `docker_ref` string
  - `automated` boolean
  - `key_arn` string
  - `instance_profile` string
  - `provisioned_iops` integer
  - `daily` integer
  - `monthly` integer
  - `yearly` integer
  - `pitr_days` integer
  - `make_copy` boolean
  - `keep_final` boolean
  - `enable_backups` boolean
  - `enable_pitr` boolean
  - `settings` object: Non-sensitive settings for the operation
  - `sensitive_settings` object: Sensitive settings for the operation (encrypted)

## Response `201`

successful

- Operation
  - `id` integer, required
  - `_type` string, required
  - `type` string, required
  - `status` string, required
  - `cancelled` boolean, required
  - `aborted` boolean, required
  - `git_ref` string, required
  - `docker_ref` string, required
  - `deploy_image_id` integer
  - `env` object
  - `container_size` integer, required
  - `container_count` integer, required
  - `disk_size` integer, required
  - `command` string, required
  - `handle` string, required
  - `created_at` string, dateTime, required
  - `updated_at` string, dateTime, required
  - `certificate` string, required
  - `private_key` string
  - `user_name` string, required
  - `user_email` string, required
  - `destination_region` string, required
  - `interactive` boolean, required
  - `instance_profile` string, required
  - `mount_point` string, required
  - `daily` integer, required
  - `monthly` integer, required
  - `yearly` integer, required
  - `pitr_days` integer, required
  - `make_copy` boolean, required
  - `keep_final` boolean, required
  - `enable_backups` boolean, required
  - `enable_pitr` boolean, required
  - `settings` object, required
  - `sensitive_settings` object
  - `_links` OperationLinks
    - `user` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `resource` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `account` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `destination_account` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `ssh_portal_connections` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `ephemeral_sessions` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `code_scan_result` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `deploy_image` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `service` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri
    - `self` ListAccountsForStack200ResponseLinksStack
      - `href` string, uri

## Other responses

- `default`: Error response. Often a 4xx or 5xx status code

## Changes

- **2026-10-20** `ba72edfe0324`: 3 info
  - added the new optional request property `deploy_image_id`
  - added the optional property `_links/deploy_image` to the response with the `201` status
  - added the optional property `deploy_image_id` to the response with the `201` status
- **2026-07-24** `1dc1e5b8c6eb`: 3 breaking, 2 info
  - the response property `env` became optional for the status `201`
  - the response property `private_key` became optional for the status `201`
  - the response property `sensitive_settings` became optional for the status `201`
  - added the new optional `header` request parameter `Prefer`
  - …1 more
- **2025-11-14** `a0af32b45330`: 4 info
  - added the new optional request property `sensitive_settings`
  - added the new optional request property `settings`
  - added the required property `sensitive_settings` to the response with the `201` status
  - added the required property `settings` to the response with the `201` status
- **2025-09-23** `feb595c222a1`: 4 info
  - added the new optional request property `enable_backups`
  - added the new optional request property `enable_pitr`
  - added the required property `enable_backups` to the response with the `201` status
  - added the required property `enable_pitr` to the response with the `201` status
- …earlier changes not shown

[Operation history](https://skmtc.dev/aptible/apis/aptible-api-v1/changes/metric_drains/:metric_drain_id/operations/post.md)

---

[API](https://skmtc.dev/aptible/apis/aptible-api-v1.md) - [All operations](https://skmtc.dev/aptible/apis/aptible-api-v1/llms.txt) - [OpenAPI document](https://skmtc.dev/aptible/apis/aptible-api-v1/revisions/a21f6b1bc6fe?raw)
