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

# Update query

Update an existing saved Explorer query. This allows you to modify the SQL, parameters, or configuration of a previously created query.

## Key Parameters

* **query\_id** - The ID of the query to update (in the URL path)
* **config.sql** - The updated SQL query to execute
* **config.limit** - Maximum number of rows to return
* **config.parameters** - Updated parameter definitions for templated queries
* **config.compute\_profile** - Updated compute profile identifier

## Permissions

You can only update queries that:

* Were created by your API key's organization
* You have edit permissions for

## Example: Updating Query SQL

```bash theme={null}
curl -X PUT "https://api.allium.so/api/v1/explorer/queries/abc123..." \
  -H "X-API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "sql": "SELECT block_number, hash, value FROM ethereum.raw.transactions WHERE block_timestamp > {{start_date}} LIMIT {{limit}}",
      "limit": 5000,
      "parameters": {
        "start_date": "2024-01-01",
        "limit": "5000"
      }
    }
  }'
```

## Use Cases

Common scenarios for updating queries:

* **Optimize SQL** - Improve query performance by refining the SQL
* **Adjust row limits** - Change the maximum number of rows returned
* **Update parameters** - Modify default parameter values
* **Change compute profile** - Switch to a different compute resource

## Next Steps

After updating a query:

1. [Run the updated query](/api/explorer/run-query) to verify the changes
2. Check the results to ensure they match your expectations
