Skip to content

ExamplesPath Parameters

Path Parameters

Dynamic URL segments with :param placeholders, auto-replaced from variables.

both modes

Simple :id

A single path parameter replaced from the variables object.

ts
// Method definition with :id placeholder
getById: endpoint.get(":id").variables<{ id: number }>().response<User>()

// Usage — :id is replaced with the value from variables
await caller.users.getById({ id: 1 })
// → GET /users/1
caller.users.getByIdSANDBOX
idle
// run the request to see the response
Path params docs

Nested :id/posts/:postId

Multiple path params in a single URL — all replaced from variables.

ts
// Multiple path params in one URL
getUserPost: endpoint.get(":id/posts/:postId").variables<{ id: number; postId: number }>().response<UserPostResponse>()

// Both :id and :postId are replaced
await caller.users.getUserPost({ id: 1, postId: 2 })
// → GET /users/1/posts/2
caller.users.getUserPostSANDBOX
idle
// run the request to see the response

Query Params

Variables that don't match a :placeholder become query parameters.

ts
// Path params + query params work together
// Variables matching :placeholders go into the URL path
// Remaining variables go as query params

getAll: endpoint.get("").variables<{ page?: number; limit?: number }>().response<UsersListResponse>()

// No path params — all variables become ?query params
await caller.users.getAll({ page: 1, limit: 5 })
// → GET /users?page=1&limit=5
caller.users.getAllSANDBOX
idle
// run the request to see the response