# Path and query parameters (https://effetch.pages.dev/docs/calls/parameters)

Fill in a path's `:name` parameters from `params`, and build the query string
from a plain `query` object.

## Fill in path parameters and a query

The following calls fill in an `:id` parameter, and send a query with a
number, a repeated key and a dropped value:

```ts
import * as Schema from "effect/Schema";

import type { Fetch } from "@monarcode/effetch";

declare const api: Fetch.Client;

const Todo = Schema.Struct({ id: Schema.Finite, title: Schema.String });

// GET /todos/1
export const one = api.get("/todos/:id", { params: { id: 1 }, output: Todo });

// GET /todos?page=1&tags=work&tags=home
export const some = api.get("/todos", {
  query: { page: 1, tags: ["work", "home"], search: undefined },
  output: Schema.Array(Todo),
});
```

## Path parameters

Every `:name` in a path is a parameter, filled in from `params`. When a path
has parameters, `params` is required, with exactly those names, and when it
has none, `params` isn't allowed. Effetch URI-encodes the values for you.

## Query parameters

`query` is a plain object. Arrays repeat the key, and `null` and `undefined`
are dropped, so you can pass optional filters as they are.

With Effect 4.1 or later, a value can also be `Redacted`, such as
`Redacted.make(apiKey)`: it's sent as its value, and Effect keeps it out of
its own logs and traces.

To type an endpoint's query and send values such as dates, give the endpoint
a schema for it. See [Typed query parameters](https://effetch.pages.dev/docs/endpoints/typed-query).

## What's next

- [Send a body](https://effetch.pages.dev/docs/calls/body): send data with `post`, `put` and `patch`.
- [Read the response](https://effetch.pages.dev/docs/calls/responses): decode the body with a schema.
- [Typed query parameters](https://effetch.pages.dev/docs/endpoints/typed-query): type a query with a
  schema.