---
title: "Update API key expiration"
method: POST
path: "/v1/api-keys/expiration"
tags: ["API key"]
---

# Update API key expiration

`POST /v1/api-keys/expiration`

Change the expiration of an API key. Acts on the key that authenticates this request unless target is OTHER. Choose set to pin an absolute date, extend or prepone to move the date by a number of days, or remove to make the key never expire. Once a key expires it can no longer authenticate.

<span>⚡ <strong>Rate limit:</strong> 30 requests per 1 minute</span>

<span>💰 <strong>Cost:</strong> FREE! No credits are charged for this API.&nbsp;<span title="Pricing shown is default pricing. Actual pricing may vary.">ⓘ</span></span>

## Request body

- object
  - `apiKey` string, required — Your Fiber API key
  - `target` 'SELF' | 'OTHER' — Which key to act on. SELF acts on the key that authenticates this request. OTHER acts on a different key in your organization, supplied in targetApiKey.
  - `targetApiKey` string, nullable — The key to act on when target is OTHER. Must belong to your organization. You can pass prefix, id, or the raw key. Omit when target is SELF.
  - `operation` 'set' | 'extend' | 'prepone' | 'remove', required — set: use an absolute date. extend: push the expiration later by a number of days. prepone: pull it earlier by a number of days. remove: make the key never expire.
  - `expiresAt` string, date-time, nullable — The new absolute expiration timestamp (ISO 8601). Required for the set operation and must be in the future; ignored otherwise.
  - `days` integer, nullable — How many days to move the expiration by. Required for the extend and prepone operations; ignored otherwise.

## Response `200`

Default Response

- object
  - `output` object, required
    - `id` string, required — id of your api key. This or prefix can be used to identify the key.
    - `name` string, required — Name of your api key.
    - `prefix` string, required — Non secret prefix of your api key. Used for identification.
    - `expiresAt` string, date-time, nullable, required — When the key expires. Null implies key never expires.
    - `maxCredits` number, nullable, required — The lifetime credit ceiling for this key. Null implies key has no per-key credit limit.
    - `creditsUsed` number, required — Credits consumed by this key so far over its lifetime.
    - `createdAt` string, date-time, required — When the key was created, as an ISO 8601 timestamp.
    - `isRevoked` boolean, required — Whether the key has been revoked. Revoked keys can no longer authenticate. Only ever true in listings that include revoked keys.
  - `chargeInfo` union, required
    - object — Credits were charged immediately for this operation
      - `method` 'charged-now', required
      - `creditsCharged` number, required
      - `lowCreditAlert` object, nullable — Contains a link to get more credits, a warning message, and the remaining credit count.
        - `getMoreCreditsUrl` string, uri, required — URL to top up credits or restart billing cycle to get fresh credits.
        - `message` string, required — Human-readable credits warning.
        - `availableCredits` number, required — Number of credits remaining in the current billing period.
    - object — Credits will be charged after the operation completes
      - `method` 'charging-later', required
      - `message` string, required
      - `lowCreditAlert` object, nullable — Contains a link to get more credits, a warning message, and the remaining credit count.
        - `getMoreCreditsUrl` string, uri, required — URL to top up credits or restart billing cycle to get fresh credits.
        - `message` string, required — Human-readable credits warning.
        - `availableCredits` number, required — Number of credits remaining in the current billing period.
    - object — Credits that were charged for an asynchronous operation
      - `method` 'charged-for-async-process', required
      - `creditsCharged` number, required
      - `message` string, required
      - `lowCreditAlert` object, nullable — Contains a link to get more credits, a warning message, and the remaining credit count.
        - `getMoreCreditsUrl` string, uri, required — URL to top up credits or restart billing cycle to get fresh credits.
        - `message` string, required — Human-readable credits warning.
        - `availableCredits` number, required — Number of credits remaining in the current billing period.
    - object — No credits were charged for this operation
      - `method` 'free', required
      - `message` string, required
      - `lowCreditAlert` object, nullable — Contains a link to get more credits, a warning message, and the remaining credit count.
        - `getMoreCreditsUrl` string, uri, required — URL to top up credits or restart billing cycle to get fresh credits.
        - `message` string, required — Human-readable credits warning.
        - `availableCredits` number, required — Number of credits remaining in the current billing period.
    - object — Credits were refunded for this operation
      - `method` 'credits-refunded', required
      - `creditsRefunded` number, required
      - `message` string, required
      - `lowCreditAlert` object, nullable — Contains a link to get more credits, a warning message, and the remaining credit count.
        - `getMoreCreditsUrl` string, uri, required — URL to top up credits or restart billing cycle to get fresh credits.
        - `message` string, required — Human-readable credits warning.
        - `availableCredits` number, required — Number of credits remaining in the current billing period.
  - `warnings` object[], nullable — Warnings about extraneous fields in request
    - `field` string, required — Full path to extraneous field (e.g., 'searchParams.ExtraField')
    - `message` string, required — Warning message
  - `advice` string[], nullable — Tips, recommendations, and suggestions for using this API effectively.

## Other responses

- `400` — Default Response
- `401` — Default Response
- `402` — Default Response
- `403` — Default Response
- `404` — Default Response
- `422` — Default Response
- `429` — Default Response
- `500` — Default Response
- `503` — Default Response

---

[API](https://skmtc.net/fiber/apis/fiber-ai-api.md) · [All operations](https://skmtc.net/fiber/apis/fiber-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fiber/fiber-ai-api/revisions/87ad9a3ecc4c/schema)
