# Get todos by IDs

`POST /v4/todos/get-many`

Fetch multiple todos in one request. Requires `todos:read`.

Send up to 100 IDs in `ids`. Only existing todos are returned; unknown IDs are silently omitted. Result order is not guaranteed to match request order; match results by their `id`.

Authentication (security requirement alternatives):

```json
[
  {
    "bearer_auth": [
      "todos:read"
    ]
  },
  {
    "oauth2_auth": [
      "todos:read"
    ]
  },
  {
    "apikey_auth": [
      "todos:read"
    ]
  }
]
```

- bearer_auth: http (bearer). API key or OAuth access token in Authorization header; scopes: todos:read
- oauth2_auth: oauth2. OAuth authorization code flow with mandatory S256 PKCE.; scopes: todos:read
- apikey_auth: apiKey, query api_key. API key in query string; scopes: todos:read

Request body: application/json

Type: object

- `ids` (required)
  Type: array
  
  Array of todo IDs to fetch (max 100)

Responses:

- 200: Todos

Content type: application/json

Type: object

Schema: [TodoListResponse](https://docs.searchsoftware.nl/api/models/todolistresponse.md)

- `status` (required)
  Type: string
  
  enum: ["ok"]
  
  Example:
  
  ```json
  "ok"
  ```

- `data` (required)
  Type: array
  
  Items:
    Reference: [TodoObject](https://docs.searchsoftware.nl/api/models/todoobject.md); Type: object

- 400: Invalid id in request body

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "INVALID_BODY",
    "status_code": 400,
    "message": "Invalid request body"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "INVALID_BODY",
    "status_code": 400,
    "message": "Invalid request body"
  }
}
```

- 401: Invalid API key

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "INVALID_API_KEY",
    "status_code": 401,
    "message": "Invalid API key"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "INVALID_API_KEY",
    "status_code": 401,
    "message": "Invalid API key"
  }
}
```

- 403: Insufficient scope

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "FORBIDDEN",
    "status_code": 403,
    "message": "Insufficient scope"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "FORBIDDEN",
    "status_code": 403,
    "message": "Insufficient scope"
  }
}
```

- 422: Too many ids or invalid request body

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "VALIDATION_FAILED",
    "status_code": 422,
    "message": "Validation failed"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "VALIDATION_FAILED",
    "status_code": 422,
    "message": "Validation failed"
  }
}
```

- 500: Internal server error

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "INTERNAL_ERROR",
    "status_code": 500,
    "message": "Internal server error"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "INTERNAL_ERROR",
    "status_code": 500,
    "message": "Internal server error"
  }
}
```

## Examples

### cURL

```bash
curl -X POST 'https://api.searchsoftware.nl/v4/todos/get-many' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "ids": []
}'
```

### TypeScript

```typescript
const body = `{
  "ids": []
}`;

const response = await fetch('https://api.searchsoftware.nl/v4/todos/get-many', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "ids": []
}'''

response = requests.post(
    'https://api.searchsoftware.nl/v4/todos/get-many',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```

### Ruby

```ruby
require 'net/http'
require 'json'

uri = URI('https://api.searchsoftware.nl/v4/todos/get-many')
request = Net::HTTP::Post.new(uri)
request.body = <<-'BODY'.chomp
{
  "ids": []
}
BODY
request['Authorization'] = 'Bearer YOUR_TOKEN'
request['Content-Type'] = 'application/json'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
data = JSON.parse(response.body)
```

### Go

```go
package main

import (
  "fmt"
  "io"
  "net/http"
  "strings"
)

func main() {
  body := strings.NewReader(`{
  "ids": []
}`)
  req, _ := http.NewRequest("POST", "https://api.searchsoftware.nl/v4/todos/get-many", body)
  req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
  req.Header.Set("Content-Type", "application/json")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  data, _ := io.ReadAll(resp.Body)
  fmt.Println(string(data))
}
```

### PHP

```php
<?php
$body = <<<'BODY'
{
  "ids": []
}
BODY;

$ch = curl_init('https://api.searchsoftware.nl/v4/todos/get-many');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

### Rust

```rust
use reqwest;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let client = reqwest::Client::new();
    let body = r#"{
  "ids": []
}"#;
    let response = client.post("https://api.searchsoftware.nl/v4/todos/get-many")
        .body(body)
        .header("Authorization", "Bearer YOUR_TOKEN")
        .header("Content-Type", "application/json")
        .send()
        .await?
        .text()
        .await?;
    println!("{}", response);
    Ok(())
}
```
