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

# Create

> Create an OpenRouter API Key Rotation for the specified project.

<Note>
  Check out the configuration docs for [OpenRouter API Key Rotations](/documentation/platform/secret-rotation/openrouter-api-key) to learn how to obtain the required parameters.
</Note>

Creates an OpenRouter API Key secret rotation. Infisical will create and rotate API keys via your [OpenRouter connection](/integrations/app-connections/openrouter) and write them to the specified secret path.

## Request body

| Field                           | Type          | Required | Description                                                                  |
| ------------------------------- | ------------- | -------- | ---------------------------------------------------------------------------- |
| `name`                          | string        | Yes      | A unique name for the rotation (max 100 characters).                         |
| `projectId`                     | string (UUID) | Yes      | The project ID.                                                              |
| `connectionId`                  | string (UUID) | Yes      | ID of the OpenRouter app connection (Provisioning API key).                  |
| `environment`                   | string        | Yes      | Environment slug (e.g. `dev`, `prod`).                                       |
| `secretPath`                    | string        | Yes      | Path where the generated API key secret will be stored.                      |
| `isAutoRotationEnabled`         | boolean       | Yes      | Whether to rotate automatically on the schedule.                             |
| `rotationInterval`              | number        | Yes      | Days between rotations (e.g. `30`).                                          |
| `rotateAtUtc`                   | object        | Yes      | Time of day (UTC) to run rotation: `{ "hours", "minutes" }`.                 |
| `parameters.name`               | string        | Yes      | Name for the API key in OpenRouter (max 100 characters).                     |
| `parameters.limit`              | number        | Yes      | Usage limit for the key.                                                     |
| `parameters.limitReset`         | string        | Yes      | `"monthly"` or `"never"`.                                                    |
| `parameters.includeByokInLimit` | boolean       | No       | Whether BYOK usage counts toward the limit. Default `false`.                 |
| `secretsMapping.apiKey`         | string        | Yes      | Secret key name to store the generated API key (e.g. `OPEN_ROUTER_API_KEY`). |
| `description`                   | string        | No       | Optional description.                                                        |

## Sample request

```bash theme={"dark"}
curl --request POST \
  --url https://us.infisical.com/api/v2/secret-rotations/open-router-api-key \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --data '{
    "name": "my-openrouter-rotation",
    "projectId": "<project-id>",
    "description": "OpenRouter API key rotation",
    "connectionId": "<openrouter-connection-id>",
    "environment": "dev",
    "secretPath": "/",
    "isAutoRotationEnabled": true,
    "rotationInterval": 30,
    "rotateAtUtc": { "hours": 0, "minutes": 0 },
    "parameters": {
      "name": "my-app-key",
      "limit": 100,
      "limitReset": "monthly",
      "includeByokInLimit": false
    },
    "secretsMapping": {
      "apiKey": "OPEN_ROUTER_API_KEY"
    }
  }'
```

## Sample response

```json theme={"dark"}
{
  "secretRotation": {
    "id": "<rotation-id>",
    "name": "my-open-router-rotation",
    "description": "OpenRouter API key rotation",
    "secretsMapping": { "apiKey": "OPEN_ROUTER_API_KEY" },
    "isAutoRotationEnabled": true,
    "activeIndex": 0,
    "connectionId": "<open-router-connection-id>",
    "rotationInterval": 30,
    "rotateAtUtc": { "hours": 0, "minutes": 0 },
    "type": "open-router-api-key",
    "parameters": {
      "name": "my-app-key",
      "limit": 100,
      "limitReset": "monthly",
      "includeByokInLimit": false
    }
  }
}
```


## OpenAPI

````yaml POST /api/v2/secret-rotations/open-router-api-key
openapi: 3.0.3
info:
  title: Infisical API
  description: List of all available APIs that can be consumed
  version: 0.0.1
servers:
  - url: https://us.infisical.com
    description: Production server (US)
  - url: https://eu.infisical.com
    description: Production server (EU)
  - url: http://localhost:8080
    description: Local server
security: []
paths:
  /api/v2/secret-rotations/open-router-api-key:
    post:
      tags:
        - Secret Rotations
      description: Create an OpenRouter API Key Rotation for the specified project.
      operationId: createOpenRouterAPIKeyRotation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 64
                  description: >-
                    The name of the OpenRouter API Key Rotation to create. Must
                    be slug-friendly.
                projectId:
                  type: string
                  minLength: 1
                  description: The ID of the project to create the rotation in.
                description:
                  type: string
                  maxLength: 256
                  nullable: true
                  description: An optional description for the OpenRouter API Key Rotation.
                connectionId:
                  type: string
                  format: uuid
                  description: The ID of the OpenRouter Connection to use for rotation.
                environment:
                  type: string
                  minLength: 1
                  maxLength: 64
                  description: >-
                    The slug of the project environment to create the rotation
                    in.
                secretPath:
                  type: string
                  minLength: 1
                  description: The secret path of the project to create the rotation in.
                isAutoRotationEnabled:
                  type: boolean
                  default: true
                  description: >-
                    Whether secrets should be automatically rotated when the
                    specified rotation interval has elapsed.
                rotationInterval:
                  type: number
                  minimum: 1
                  description: The interval, in days, to automatically rotate secrets.
                rotateAtUtc:
                  type: object
                  properties:
                    hours:
                      type: number
                      minimum: 0
                      maximum: 23
                    minutes:
                      type: number
                      minimum: 0
                      maximum: 59
                  required:
                    - hours
                    - minutes
                  additionalProperties: false
                  description: >-
                    The hours and minutes rotation should occur at in UTC.
                    Defaults to Midnight (00:00) UTC.
                parameters:
                  type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 100
                      description: The name for the generated OpenRouter API key.
                    limit:
                      type: number
                      exclusiveMinimum: true
                      minimum: 0
                      nullable: true
                      description: >-
                        The optional spending limit in USD for the generated API
                        key.
                    limitReset:
                      type: string
                      enum:
                        - daily
                        - weekly
                        - monthly
                      nullable: true
                      description: >-
                        The type of limit reset for the API key (daily, weekly,
                        monthly, or null for no reset).
                    includeByokInLimit:
                      type: boolean
                      nullable: true
                      description: >-
                        Whether to include BYOK (Bring Your Own Key) usage in
                        the spending limit. When enabled, usage from your own
                        provider keys counts toward this key's limit. See
                        OpenRouter BYOK docs for details.
                  required:
                    - name
                  additionalProperties: false
                secretsMapping:
                  type: object
                  properties:
                    apiKey:
                      type: string
                      minLength: 1
                      description: >-
                        The name of the secret that the rotated OpenRouter API
                        key will be mapped to.
                  required:
                    - apiKey
                  additionalProperties: false
              required:
                - name
                - projectId
                - connectionId
                - environment
                - secretPath
                - rotationInterval
                - parameters
                - secretsMapping
              additionalProperties: false
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  secretRotation:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      description:
                        type: string
                        nullable: true
                      isAutoRotationEnabled:
                        type: boolean
                        default: true
                      activeIndex:
                        type: number
                        default: 0
                      folderId:
                        type: string
                        format: uuid
                      connectionId:
                        type: string
                        format: uuid
                      createdAt:
                        type: string
                        format: date-time
                      updatedAt:
                        type: string
                        format: date-time
                      rotationInterval:
                        type: number
                      rotationStatus:
                        type: string
                      lastRotationAttemptedAt:
                        type: string
                        format: date-time
                      lastRotatedAt:
                        type: string
                        format: date-time
                      lastRotationJobId:
                        type: string
                        nullable: true
                      nextRotationAt:
                        type: string
                        format: date-time
                        nullable: true
                      isLastRotationManual:
                        type: boolean
                        default: true
                      connection:
                        type: object
                        properties:
                          app:
                            type: string
                            enum:
                              - open-router
                          name:
                            type: string
                          id:
                            type: string
                            format: uuid
                        required:
                          - app
                          - name
                          - id
                        additionalProperties: false
                      environment:
                        type: object
                        properties:
                          slug:
                            type: string
                          name:
                            type: string
                          id:
                            type: string
                            format: uuid
                        required:
                          - slug
                          - name
                          - id
                        additionalProperties: false
                      projectId:
                        type: string
                      folder:
                        type: object
                        properties:
                          id:
                            type: string
                          path:
                            type: string
                        required:
                          - id
                          - path
                        additionalProperties: false
                      rotateAtUtc:
                        type: object
                        properties:
                          hours:
                            type: number
                            minimum: 0
                            maximum: 23
                          minutes:
                            type: number
                            minimum: 0
                            maximum: 59
                        required:
                          - hours
                          - minutes
                        additionalProperties: false
                      lastRotationMessage:
                        type: string
                        nullable: true
                      type:
                        type: string
                        enum:
                          - open-router-api-key
                      parameters:
                        type: object
                        properties:
                          name:
                            type: string
                            minLength: 1
                            maxLength: 100
                            description: The name for the generated OpenRouter API key.
                          limit:
                            type: number
                            exclusiveMinimum: true
                            minimum: 0
                            nullable: true
                            description: >-
                              The optional spending limit in USD for the
                              generated API key.
                          limitReset:
                            type: string
                            enum:
                              - daily
                              - weekly
                              - monthly
                            nullable: true
                            description: >-
                              The type of limit reset for the API key (daily,
                              weekly, monthly, or null for no reset).
                          includeByokInLimit:
                            type: boolean
                            nullable: true
                            description: >-
                              Whether to include BYOK (Bring Your Own Key) usage
                              in the spending limit. When enabled, usage from
                              your own provider keys counts toward this key's
                              limit. See OpenRouter BYOK docs for details.
                        required:
                          - name
                        additionalProperties: false
                      secretsMapping:
                        type: object
                        properties:
                          apiKey:
                            type: string
                            minLength: 1
                            description: >-
                              The name of the secret that the rotated OpenRouter
                              API key will be mapped to.
                        required:
                          - apiKey
                        additionalProperties: false
                    required:
                      - id
                      - name
                      - folderId
                      - connectionId
                      - createdAt
                      - updatedAt
                      - rotationInterval
                      - rotationStatus
                      - lastRotationAttemptedAt
                      - lastRotatedAt
                      - connection
                      - environment
                      - projectId
                      - folder
                      - rotateAtUtc
                      - type
                      - parameters
                      - secretsMapping
                    additionalProperties: false
                required:
                  - secretRotation
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 400
                  message:
                    type: string
                  error:
                    type: string
                  details: {}
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 401
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 403
                  message:
                    type: string
                  details: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 404
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 422
                  message: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 500
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false

````