# cURL with API key in C#

Paste a curl command that uses API key and get C# code using HttpClient. Toolpaper also detects secrets and offers a one-click redaction before sharing.

## Example

```bash
curl https://api.example.com/me \
  -H "X-API-Key: YOUR_KEY"
```

## What the converter handles

- The X-API-Key (or custom key header) name is preserved exactly as sent; case-sensitive gateways keep working.
- Secrets are visible in the parsed request. Use the Clean panel's redact-and-diff flow before you paste the command anywhere.
- Shareable links Base64-encode the input — they never leave your browser, and cleaned versions produce different links.

## Common mistakes

- Duplicating the key header (once via -H, once via a gateway middleware) — the generator warns when the same header appears twice.
- Not rotating a leaked credential because "it's only in a screenshot" — screenshots get OCR'd, redact first.
- Trusting HTTPS alone for API keys in query strings — proxies log URLs. Prefer headers, which the converter defaults to.

## FAQ

### How is API key rendered in C#?

The X-API-Key header (or any custom API-key header name) passes through unchanged to the generated code.

### Can I redact the secret before sharing?

Yes. Open the Clean panel — Toolpaper detects Bearer tokens, Basic credentials, and common API-key patterns and replaces them with <REDACTED> in a diffable view.

### Does anything leave my browser?

No. Parsing, redaction, and generation are 100% client-side.

---

Source: https://toolpaper.manavdev.site/how-to/curl-api-key-auth-in-csharp · Language hub: https://toolpaper.manavdev.site/curl-to-csharp