> ## Documentation Index
> Fetch the complete documentation index at: https://trigger.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set skew protection threshold

> Set or move the environment's skew protection threshold, or with `task` the threshold of that one task. Sessions on versions before it move to the current deployment the next time they're used. The version must be deployed in this environment and at or below the current deployment. Setting the version that is already the threshold changes nothing. Use a secret key from a deployed environment, such as staging or production. Development environments return 400.



## OpenAPI

````yaml v3-openapi PUT /api/v1/deployments/skew-protection-threshold
openapi: 3.1.0
info:
  title: Trigger.dev v3 REST API
  description: >-
    The REST API lets you trigger and manage runs on Trigger.dev. You can
    trigger a run, get the status of a run, and get the results of a run. 
  version: 2024-04
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.trigger.dev
    description: Trigger.dev API
security: []
paths:
  /api/v1/deployments/skew-protection-threshold:
    put:
      tags:
        - deployments
      summary: Set skew protection threshold
      description: >-
        Set or move the environment's skew protection threshold, or with `task`
        the threshold of that one task. Sessions on versions before it move to
        the current deployment the next time they're used. The version must be
        deployed in this environment and at or below the current deployment.
        Setting the version that is already the threshold changes nothing. Use a
        secret key from a deployed environment, such as staging or production.
        Development environments return 400.
      operationId: set_skew_protection_threshold_v1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - version
              properties:
                version:
                  type: string
                  maxLength: 64
                  description: >-
                    A deployed version in this environment, at or below the
                    current deployment (e.g. "20261109.22").
                task:
                  type: string
                  minLength: 1
                  maxLength: 256
                  description: >-
                    A task id. The threshold then covers only that task's
                    sessions, and the task must exist in the current deployment.
                    Leave it out to cover every session in the environment.
      responses:
        '200':
          description: The environment's skew protection state after the change
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkewProtectionThresholdState'
        '400':
          description: >-
            The version isn't digits and dots or is over 64 characters, `task`
            is empty or over 256 characters, the body is invalid, or the key
            belongs to a development environment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkewProtectionThresholdError'
        '401':
          description: >-
            Unauthorized. The API key is missing or invalid, or isn't a secret
            key
        '403':
          description: The API key can't write deployments
        '404':
          description: >-
            No deployed deployment with this version in the environment, or
            `task` isn't in the current deployment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkewProtectionThresholdError'
        '409':
          description: >-
            The version is above the current deployment, the environment has no
            current deployment, or 50 tasks already have their own threshold
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkewProtectionThresholdError'
      security:
        - secretKey: []
      x-codeSamples:
        - lang: curl
          source: >-
            curl -X PUT
            "https://api.trigger.dev/api/v1/deployments/skew-protection-threshold"
            \
              -H "Authorization: Bearer tr_prod_sk_1234" \
              -H "Content-Type: application/json" \
              -d '{"version":"20261109.22"}'
components:
  schemas:
    SkewProtectionThresholdState:
      type: object
      properties:
        currentVersion:
          type: string
          nullable: true
          description: The current deployment's version, or null when nothing is current.
          example: '20261109.22'
        threshold:
          description: >-
            The environment's skew protection threshold, or null when none is
            set.
          anyOf:
            - $ref: '#/components/schemas/SkewProtectionThreshold'
            - type: 'null'
        tasks:
          type: object
          description: >-
            Each task's own skew protection threshold, by task id. Empty when no
            task has one.
          additionalProperties:
            $ref: '#/components/schemas/SkewProtectionThreshold'
    SkewProtectionThresholdError:
      type: object
      properties:
        error:
          type: string
          example: No deployed deployment with version 99999999.1 in this environment.
    SkewProtectionThreshold:
      type: object
      properties:
        version:
          type: string
          example: '20261109.22'
        deploymentId:
          type: string
          nullable: true
          description: The ID of the deployment with this version.
          example: deployment_exv9bt4gdbuun6mc24iuq
        setAt:
          type: string
          format: date-time
        setBy:
          type: object
          nullable: true
          properties:
            type:
              type: string
              enum:
                - user
                - api
                - migrated
              description: >-
                `user` from the dashboard, `api` through this API, `migrated`
                when Trigger.dev set it for you.
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      description: >
        Use a named environment API key. It starts with `tr_dev_sk_`,
        `tr_prod_sk_`, `tr_stg_sk_`, etc.


        Create a named API key in the API Keys section of your Trigger.dev
        project dashboard. Choose the narrowest access preset that supports your
        integration.


        Our TypeScript SDK will default to using the value of the
        `TRIGGER_SECRET_KEY` environment variable if it is set. If you are using
        the SDK in a different environment, you can set the key using the
        `configure` function.


        ```typescript

        import { configure } from "@trigger.dev/sdk";


        configure({ accessToken: "tr_dev_sk_1234" });

        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.