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

# Update URL Status

> Update only the status of a URL (ACTIVE / INACTIVE).

Toggle a URL between active and inactive without modifying other properties.

**Authentication**: Required — you must own the URL.

**API Key Scope**: `urls:manage` or `admin:all`

**Rate Limits**: 120/min, 2,000/day

**Status Values**:
- `ACTIVE` — URL is accessible and redirects normally
- `INACTIVE` — URL is disabled and returns an error page

**Use Cases**:
- Set `INACTIVE` to temporarily disable redirects without deleting the URL
- Set `ACTIVE` to re-enable a previously disabled URL



## OpenAPI

````yaml /openapi-v1.json patch /api/v1/urls/{url_id}/status
openapi: 3.1.0
info:
  title: spoo.me
  description: >-
    REST API for spoo.me — free and open-source URL shortening service serving
    400k+ redirects/day.


    Authenticate using either:

    - **API Key**: `Authorization: Bearer spoo_<your_key>`

    - **JWT Token**: `Authorization: Bearer <jwt>` (obtained via /auth/login)

    - **Session Cookie**: `access_token` cookie (set automatically on login)
  contact:
    name: spoo.me
    url: https://spoo.me/contact
    email: support@spoo.me
  license:
    name: AGPL-3.0
    url: https://github.com/spoo-me/spoo/blob/main/LICENSE
  version: 1.0.0
servers:
  - url: https://spoo.me
    description: Production
security:
  - ApiKeyAuth: []
  - JWTAuth: []
tags:
  - name: URL Shortening
    description: Create new shortened URLs
  - name: Link Management
    description: List, update, and delete your shortened URLs
  - name: Statistics
    description: Click analytics and data export
  - name: API Keys
    description: Create and manage API keys for programmatic access
  - name: Authentication
    description: Login, register, password management, and email verification
  - name: OAuth
    description: OAuth provider login, linking, and unlinking
  - name: System
    description: Health checks and server metrics
paths:
  /api/v1/urls/{url_id}/status:
    patch:
      tags:
        - Link Management
      summary: Update URL Status
      description: >-
        Update only the status of a URL (ACTIVE / INACTIVE).


        Toggle a URL between active and inactive without modifying other
        properties.


        **Authentication**: Required — you must own the URL.


        **API Key Scope**: `urls:manage` or `admin:all`


        **Rate Limits**: 120/min, 2,000/day


        **Status Values**:

        - `ACTIVE` — URL is accessible and redirects normally

        - `INACTIVE` — URL is disabled and returns an error page


        **Use Cases**:

        - Set `INACTIVE` to temporarily disable redirects without deleting the
        URL

        - Set `ACTIVE` to re-enable a previously disabled URL
      operationId: updateUrlStatus
      parameters:
        - name: url_id
          in: path
          required: true
          schema:
            type: string
            description: Unique identifier of the URL
            title: Url Id
          description: Unique identifier of the URL
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUrlStatusRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateUrlResponse'
        '400':
          description: Bad Request — invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized — missing or invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden — insufficient permissions or scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    UpdateUrlStatusRequest:
      properties:
        status:
          type: string
          enum:
            - ACTIVE
            - INACTIVE
          title: Status
          description: >-
            New status for the URL. `ACTIVE` enables redirects, `INACTIVE`
            disables them.
          examples:
            - ACTIVE
      type: object
      required:
        - status
      title: UpdateUrlStatusRequest
      description: Request body for updating only the status of a shortened URL.
    UpdateUrlResponse:
      properties:
        id:
          type: string
          title: Id
          description: MongoDB ObjectId of the URL.
          examples:
            - 507f1f77bcf86cd799439011
        alias:
          anyOf:
            - type: string
            - type: 'null'
          title: Alias
          description: Short code.
          examples:
            - mylink
        long_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Long Url
          description: Destination URL.
          examples:
            - https://example.com/long/url
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: URL status.
          examples:
            - ACTIVE
        password_set:
          type: boolean
          title: Password Set
          description: Whether the URL is password-protected.
        max_clicks:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Clicks
          description: Click limit, or null if unlimited.
          examples:
            - 100
        expire_after:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expire After
          description: Expiration as Unix timestamp, or null.
          examples:
            - 1735689599
        block_bots:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Block Bots
          description: Whether bot blocking is enabled.
        private_stats:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Private Stats
          description: Whether statistics are private.
        updated_at:
          type: integer
          title: Updated At
          description: Last update time as Unix timestamp.
          examples:
            - 1704067200
      type: object
      required:
        - id
        - password_set
        - updated_at
      title: UpdateUrlResponse
      description: >-
        Response body after a successful URL update (PATCH
        /api/v1/urls/{url_id}).
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
        error_code:
          type: string
          title: Error Code
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
        details:
          anyOf:
            - {}
            - type: 'null'
          title: Details
      type: object
      required:
        - error
        - error_code
      title: ErrorResponse
      description: Standard error JSON body produced by the AppError exception handler.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: spoo_<key>
      description: 'API key authentication. Pass your key as: `Bearer spoo_<your_key>`'
    JWTAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'JWT access token from /auth/login. Pass as: `Bearer <jwt_token>`'

````