# Why ‘your API returns a 500’ is a ticket nobody can act on

> A request ID, a UTC timestamp and two calls that differ by a single field let the other team trace the fault with far fewer follow-up questions.

Original: https://fdetimes.net/en/guides/report-api-500-errors-that-get-fixed/

Google's Apigee support documentation is blunt: reporting only a “500 error” does not give its team enough information to investigate. They need the actual error message and error code. Yet “Your API is returning 500, please take a look” is an easy line to type while a customer is waiting.

The price is a string of follow-up questions: which request, at what time, sent with what payload? For an FDE, each round can cost a full day if the two teams are in different time zones, and the other team holds logs and source code you cannot touch. The only thing you control is the quality of the first ticket.

## The recipient needs to see it fail

Simon Tatham, author of “How to Report Bugs Effectively”, sets one aim for a bug report: to let programmers see the program failing in front of their own eyes. With an API, there are two ways to get there. Either they find your exact request in their logs, or they run a command themselves and get the same error.

A good ticket opens both routes. The first needs identifiers and a timestamp; the second needs a reproduction. If you have time to prepare only one, send the identifiers first, because they are available the moment the error occurs.

**Key point:** A good ticket helps the recipient find the exact request that failed, or make it fail again themselves.

## Which ID should you send, and when?

Providers put identifiers in different places, so start by reading the error section of their API documentation. The table below is a starting point.

| Situation | ID to send | Example |
| --- | --- | --- |
| You have a response | Request ID in the header | Stripe: `Request-Id`; Claude API: `request-id` |
| Only the error body is left | ID inside the body | Claude API: `request_id`; APIs following RFC 9457: `instance` |
| Timeout or dropped connection | ID set by the client | OpenAI: `X-Client-Request-Id` |
| The call crosses several services | Trace ID | W3C Trace Context standard |

The third row is often forgotten. When a request times out you receive no headers, so any ID generated by the provider is lost with them. OpenAI lets the client set an ID in advance, which its support team can use to check whether the request arrived, and when.

A client-set ID is useful only if it was in your logs before the incident. The Python function below records both sides, even when a request never gets a response:

```python
import logging
import uuid
from datetime import datetime, timezone
from urllib.parse import urlsplit

import requests

log = logging.getLogger("partner_api")
ID_HEADERS = ("request-id", "x-request-id")

def call(method, url, **kwargs):
    client_id = str(uuid.uuid4())
    headers = {**(kwargs.pop("headers", None) or {}),
               "X-Client-Request-Id": client_id}
    kwargs.setdefault("timeout", 30)
    sent_at = datetime.now(timezone.utc).isoformat()
    status = request_id = error = None
    try:
        resp = requests.request(method, url, headers=headers, **kwargs)
        status = resp.status_code
        request_id = next(
            (resp.headers[h] for h in ID_HEADERS if h in resp.headers), None)
        return resp
    except requests.RequestException as exc:
        error = type(exc).__name__
        raise
    finally:
        log.info(
            "sent_at=%s %s path=%s status=%s request_id=%s client_id=%s error=%s",
            sent_at, method, urlsplit(url).path, status,
            request_id, client_id, error)
```

The function deliberately logs only the path, because query strings and headers can contain secrets. Change the header names to match each partner's documentation. If a partner does not support client-set IDs, `client_id` still helps you trace your own logs, but don't expect them to be able to look it up.

## From 37 failed orders to one field

Say you are syncing 1,200 orders to a partner's API: 1,163 succeed and 37 get a 500. Don't send all 37. Your job is to find what the failed group shares and the successful group lacks.

Comparing the payloads, you see that all 37 orders carry `"discount_code": null`, while none of the other 1,163 has that value. So far this is only a correlation. To test it, take one failed order, then drop one field at a time and rerun for as long as the error persists.

Vercel calls the goal of this step a minimal reproduction: the smallest project that still shows the error. With an API, that “project” usually fits in a single curl command. Run it in a sandbox with fake data, because resending a POST in production can create duplicate orders.

```bash
export TZ=UTC
date -u +%Y-%m-%dT%H:%M:%SZ

# A: status 500
curl -sS -v --trace-time https://sandbox.example.com/v1/orders \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sku":"TEST-1","quantity":1,"discount_code":null}'

# B: status 201
curl -sS -v --trace-time https://sandbox.example.com/v1/orders \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sku":"TEST-1","quantity":1}'
```

The `--trace-time` option adds a timestamp to every verbose line, so you have the time of that specific call. Keep the first two lines: `TZ=UTC` stops the trace from using your machine's time zone, and `date -u` records the date, because curl's stamps show only the time of day.

The abridged output looks like this, with illustrative values and the key masked:

```text
2026-11-24T07:41:05Z

# A
07:41:05.318204 > POST /v1/orders HTTP/2
07:41:05.318204 > Authorization: Bearer [REDACTED]
07:41:05.562917 < HTTP/2 500
07:41:05.563020 < request-id: req_demo_a1

# B
07:41:06.104511 > POST /v1/orders HTTP/2
07:41:06.104511 > Authorization: Bearer [REDACTED]
07:41:06.331870 < HTTP/2 201
07:41:06.331992 < request-id: req_demo_b1
```

The first column is UTC time. Lines marked `>` are what you sent; lines marked `<` are what you received, including the status code and request ID to copy into the ticket.

Command B is the valuable part. Faced with a 500, the recipient may suspect a bad API key, a network problem or a call to the wrong endpoint. A and B share all three, yet B returns 201, so in the sandbox those suspicions can be set aside for now.

Production still needs its own evidence, so the ticket must also include a sample request from there. Run A and B several times, alternating between them. If the results flip back and forth, you may be dealing with an intermittent fault, and the field may not be the culprit.

## A ticket the reader can act on at once

Google Cloud advises that tickets be detailed and specific, stating what happened and what you expected. It also notes that the person handling the case may well be in a different time zone, so relative times make a problem harder to diagnose. “Around 2pm today” therefore has to become a full UTC timestamp.

A ticket for the 37 failed orders could read as follows, with illustrative IDs and times:

```text
Title: POST /v1/orders returns 500 in production; reproduced in
       sandbox when sending discount_code = null

Impact: 37/1,200 orders could not be created in production.
Observed (production): all 37 failed orders have discount_code = null;
           none of the 1,163 successful orders do. Correlation only.
Workaround: drop this field from the payload (testing in sandbox).

Sample request (production):
  sent_at:    2026-11-24T07:14:32Z
  request_id: req_demo_7f3a
  status:     500
  error body: {"code":"internal_error","message":"Unexpected error"}

Reproduction (sandbox): commands A and B in repro.sh
  A, discount_code = null:  500 (5/5 runs), request_id: req_demo_a1
  B, discount_code omitted: 201 (5/5 runs), request_id: req_demo_b1

Expected: 201 as in B, or a 4xx naming the invalid field.
Actual:   500, with no indication of which field.

Hypothesis (unverified): the API does not handle null in discount_code,
           and production fails for the same reason.

Question: does the schema allow null here?
```

The title states only what has been seen: production returns 500, while null has been tested only in the sandbox. The hypothesis sits near the end, labeled “unverified”, because Tatham treats a diagnosis as an optional extra that cannot replace the symptoms.

Open with “your parser is broken” and guess wrong, and the recipient is likely to lose time chasing that lead, while you lose credibility for the next ticket.

The final question is deliberate too. “Please take a look” has no finish line, whereas a question about the schema can be answered even before a fix ships. With that answer, you know whether to change your side or wait.

## Mistakes that spoil a careful ticket

The most dangerous mistake is sending too much. Cloudflare warns that HAR files, the recordings of browser traffic often shared during debugging, can contain sensitive information that attackers could exploit. DeepL asks users never to include API keys or sensitive content in support messages.

Verbose logs need the same scrutiny. Before attaching one, search for `Authorization`, cookies, tokens, email addresses and customer names. Replace them with `[REDACTED]`, but keep request IDs and timestamps. If a key has already gone out, revoke it and issue a new one; deleting the message is not enough.

Another mistake is to combine two incidents in one ticket because they happened on the same morning. A timeout and a 500 may be fixed by two different teams, so file them separately and cross-reference them. Avoid pasting screenshots in place of text, too: a request ID inside an image is hard to copy, hard to search for and easily mistyped.

## How do you put this skill on a CV?

If the job postings you are targeting mention integrations or production support, have one bug-reporting story ready to tell in the interview.

On your CV, go further than “integrated third-party APIs”. Spell out how you isolated a fault: how many failed requests you started from, which condition you traced them to, and what the other team then fixed. Use only real figures.

To practice, pick an old bug, rewrite its ticket using the template above, then hand it to a colleague who knows nothing about it and say nothing more. Within 10 minutes, they should be able to point to the failed request and reproduce the error. Every question they have to ask is a line missing from your ticket.

**Try this week:**

- Add UTC time, request IDs from both sides and status codes to the logs of an integration you own, then force a timeout and see what the logs still contain.
- Save the ticket template from this article in your project's repo and try filling it in with a closed bug.

## Sources

- [How to Report Bugs Effectively](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html)

- [Best practices for working with Customer Care](https://docs.cloud.google.com/support/docs/best-practices)

- [Best practices for Google Cloud Apigee support cases](https://docs.apigee.com/api-platform/troubleshoot/best-practices)

- [Request IDs](https://docs.stripe.com/api/request_ids)

- [Claude API errors](https://platform.claude.com/docs/en/api/errors)

- [API Overview](https://developers.openai.com/api/reference/overview)

- [Trace Context](https://www.w3.org/TR/trace-context/)

- [RFC 9457: Problem Details for HTTP APIs](https://www.rfc-editor.org/rfc/rfc9457.html)

- [Creating a minimal reproducible example](https://vercel.com/kb/guide/creating-a-minimal-reproducible-example)

- [curl man page](https://curl.se/docs/manpage.html)

- [Introducing HAR Sanitizer: secure HAR sharing](https://blog.cloudflare.com/introducing-har-sanitizer-secure-har-sharing/)

- [Contact](https://developers.deepl.com/docs/resources/contact)
