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

# Update a Preset

> Rename a preset or change its inputs or tool request.

Send only the fields that change. `PUT` works the same way.

```bash theme={null}
curl -X PATCH https://api.spidra.io/api/presets/15415447-7680-4dc5-90a0-f7a900c7f418 \
  -H "Authorization: Bearer $SPIDRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "inputs": { "query": "dentist", "areas": ["Lekki, Lagos", "Ikeja, Lagos"] } }'
```

```json theme={null}
{ "status": "success", "message": "Preset updated successfully" }
```

| Field | For |
| - | - |
| `name`, `description` | Any preset. |
| `inputs` | Template presets. Replaces the inputs and is checked like a run (`422` with `errors` if something needs fixing). |
| `columns` | Template presets. The columns the dashboard table shows. |
| `config` | Tool presets. Replaces the saved request body. |

Sending `inputs` or `columns` to a tool preset, or `config` to a template preset, returns `400`.


## OpenAPI

````yaml PATCH /presets/{presetId}
openapi: 3.1.0
info:
  title: Spidra API
  version: 1.0.0
  description: >-
    Public API endpoints for web scraping via Spidra. Authenticate with
    `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://api.spidra.io/api
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /presets/{presetId}:
    patch:
      tags:
        - Presets
      summary: Update a Preset
      description: >-
        Changes a preset. Send only what changes: `name`, `description`, and
        `inputs` and `columns` (template presets) or `config` (tool presets).
        `PUT` works the same way.
      parameters:
        - name: presetId
          in: path
          required: true
          schema:
            type: string
          description: The preset's ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                inputs:
                  type: object
                  description: 'Template presets: replaces the inputs (checked like a run).'
                columns:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                  description: 'Template presets: the dashboard table''s columns.'
                config:
                  type: object
                  description: 'Tool presets: replaces the tool''s request body.'
            example:
              inputs:
                query: dentist
                areas:
                  - Lekki, Lagos
                  - Ikeja, Lagos
      responses:
        '200':
          description: Updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  message:
                    type: string
        '400':
          description: A field that doesn't apply to this kind of preset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No preset with this ID on your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Some inputs need fixing. `errors` lists each field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInputError'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
      required:
        - status
        - message
    InvalidInputError:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        code:
          type: string
          enum:
            - INVALID_INPUT
        message:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
          description: One entry per field that needs fixing.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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