---
title: "Apply (create/update) a series of resources"
method: POST
path: "/apply"
tags: ["Declarative Operations"]
---

# Apply (create/update) a series of resources

`POST /apply`

## Request

- Base URL: `https://replace-with-account.api.decodable.co/v1alpha2`
- URL: `https://replace-with-account.api.decodable.co/v1alpha2/apply`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://auth.decodable.co/authorize?audience=https://api.decodable.co/`
    - Token URL: `https://auth.decodable.co/oauth/token`
- TypeScript: <https://skmtc.dev/decodable/apis/decodable-control-plane/docs/apply/post.ts> (a function with typed inputs; its response is checked against the schema)

See: [`apply` command docs](https://docs.decodable.co/declarative/apply.html) for usage details.

Requires appropriate permissions matching resources involved.

## Request body `application/x-yaml`

- DeclarativeDefinition: The declarative resource definition format.
  - `kind` 'secret' | 'stream' | 'connection' | 'pipeline', required: The resource `kind`.
  - `metadata` object, required: Identifying and labeling information for the resource.
    - `name` string, required
    - `description` string
    - `id` string
    - `tags` object
  - `spec_version` 'v1', required: The `spec` version for this resource definition.
  - `spec` union: Resource configuration, per `kind` and `spec_version`.
    - object, nullable: `kind: secret`, `spec_version: v1`: no `spec`.
    - object: `kind: stream`, `spec_version: v1`.
      - `watermark` string: The stream watermark strategy.
      - `schema` object[]: Record schema.
        - `name` string: The field name.
        - `type` string: The field type.
      - `schema_v2` SchemaV2: Record schema, version 2.
        - `fields` union[]: The fields in this schema.
          - union
            - PhysicalField: A physical field.
              - …
            - ComputedField: A computed field.
              - …
            - MetadataField: A metadata field.
              - …
        - `watermarks` object[]: Watermark expressions for this stream. At this time only one expression is supported.
          - `name` string
          - `expression` string
        - `constraints` object
          - `primary_key` string[]: Column names to use for primary key.
      - `properties` object: The stream properties.
      - `partition_key` string[]: The fields to use to partition data in the stream
    - object: `kind: connection`, `spec_version: v1`.
      - `connector` 'astra-streaming' | 'clickhouse' | 'confluent-cloud' | 'datadog' | 'datagen' | 'delta-lake' | 'druid' | 'dynamodb-cdc' | 'elasticsearch' | 'gcp-pubsub' | 'hudi' | 'influxdb' | 'kafka' | 'kinesis' | 'mongodb' | 'mongodb-cdc' | 'ms-sql' | 'mysql-cdc' | 'oracle' | 'oracle-cdc' | 'pinot' | 'polaris' | 'postgres' | 'postgres-cdc' | 'pulsar' | 'redis' | 'redpanda' | 'redshift' | 'rest' | 'rockset' | 's3' | 's3-lambda' | 's3-v2' | 'singlestore-db' | 'snowflake' | 'startree' | 'streamnative' | 'timescale': The connector used by the connection.
      - `type` 'source' | 'sink': The connection type.
      - `stream_mappings` object[]: The connection stream mappings. If present, `schema` and `stream_id` must be `null`.
        - `stream_id` string: An opaque ID, created by Decodable, that uniquely identifies a resource.
        - `external_resource_specifier` unknown
      - `stream_id` string: An opaque ID, created by Decodable, that uniquely identifies a resource.
      - `schema` object[]: Record schema.
        - `name` string: The field name.
        - `type` string: The field type.
      - `schema_v2` SchemaV2: Record schema, version 2.
        - `fields` union[]: The fields in this schema.
          - union
            - PhysicalField: A physical field.
              - …
            - ComputedField: A computed field.
              - …
            - MetadataField: A metadata field.
              - …
        - `watermarks` object[]: Watermark expressions for this stream. At this time only one expression is supported.
          - `name` string
          - `expression` string
        - `constraints` object
          - `primary_key` string[]: Column names to use for primary key.
      - `properties` object: The connection properties.
      - `autoscale_configuration` AutoscaleConfiguration, nullable: The configuration for autoscale conditions.
        - `pause_conditions` object, nullable: A map of pause conditions and their given setting values.
        - `resume_conditions` object, nullable: A map of resume conditions and their given setting values.
    - object: `kind: pipeline`, `spec_version: v1`. SQL pipeline fields only.
      - `sql` string: The pipeline SQL.
      - `snapshot_configuration` SnapshotConfiguration: The pipeline snapshot configuration.
        - `enabled` boolean: Whether or not to take snapshots.
        - `cron` string: A cron expression for scheduling the snapshot
        - `retention_period_seconds` number: A retention period for the created snapshots, in seconds.
      - `autoscale_configuration` AutoscaleConfiguration, nullable: The configuration for autoscale conditions.
        - `pause_conditions` object, nullable: A map of pause conditions and their given setting values.
        - `resume_conditions` object, nullable: A map of resume conditions and their given setting values.
      - `properties` SQLPipelineProperties
        - `secrets` string[]
    - object: `kind: pipeline`, `spec_version: v1`. Custom pipeline fields only.
      - `type` 'JAVA' | 'PYTHON': The type of the custom pipeline. Consumers should be able to gracefully handle new values in future API versions.
      - `job_file_sha` string: SHA512 hash of the job file. Must reference a file that was previously uploaded using the `/files` endpoints.
      - `job_arguments` string: Argument string input to the custom pipeline program.
      - `entry_class` string: Name of the entry class to run for this custom Java-based pipeline (optional). If not present, the class to run must be specified in the file `META-INF/MANIFEST.MF` within the job's JAR file, using the `Main-Class` property key.
      - `properties` CustomPipelineProperties
        - `secrets` string[]
        - `flink_version` string: The Flink version to run this custom pipeline on.
        - `additional_metrics` string[]
        - `flink_configuration` object: A key-value pair of additional Flink configuration to apply to the job
      - `snapshot_configuration` SnapshotConfiguration: The pipeline snapshot configuration.
        - `enabled` boolean: Whether or not to take snapshots.
        - `cron` string: A cron expression for scheduling the snapshot
        - `retention_period_seconds` number: A retention period for the created snapshots, in seconds.

## Response `200`

Success: Zero or more YAML docs, each with this schema.

Note that the response will be `application/x-yaml` by default (with one YAML doc per resource definition), but `application/json` may be selected via the `Accept:` request header.

- DeclarativeResult: A result object from a declarative `apply` or mutating `query` operation.
  - `kind` 'secret' | 'stream' | 'connection' | 'pipeline', required: The resource `kind`.
  - `name` string, required: The resource name.
  - `id` string, required: The resource ID.
  - `result` 'created' | 'updated' | 'unchanged' | 'deleted', required
  - `dry_run` boolean: When `true`, this was a dry run, and no actual changes were made.

## Other responses

- `400`: An invalid request was received.
- `403`: Access denied: requesting user lacks a required permission.
- `409`: A conflicting resource already exists.
- `default`: An error has occurred.

---

[API](https://skmtc.dev/decodable/apis/decodable-control-plane.md) - [All operations](https://skmtc.dev/decodable/apis/decodable-control-plane/llms.txt) - [OpenAPI document](https://skmtc.dev/decodable/apis/decodable-control-plane/revisions/9718a3019da8?raw)
