Use this page to handle a failed request.
Every error is built the same way, so one handler covers every endpoint.
1. Read the error
An error is JSON with an error object. code is stable, so branch on it. message is for people. A 400 also carries fields, a list of problems for each parameter.
Step: Read the error, from "Errors" in the OddsYorkie API documentation.
Write code in this project that does this step and prints or uses the result.
Request: GET https://odds-feed.on-forge.com/api/v2/matches?cup=maybe&limit=0
Read the key from the ODDSYORKIE_KEY environment variable and send it as "Authorization: Bearer <key>". Never write the key into code.
Read https://odds-feed.on-forge.com/docs/errors.md for this step first. Then read https://odds-feed.on-forge.com/docs/llms-full.txt for the rest of the API and https://odds-feed.on-forge.com/docs/AGENTS.md for the rules to follow.
Response
{"error": {"status": 400,
"code": "bad_request",
"message": "The request was invalid.",
"fields": {"limit": ["The limit field must be at least 1."],
"cup": ["The cup field must be 1, 0, true or false."]}}}
2. Handle a missing ability
A key without the ability an endpoint needs, or a plan without the markets you asked for, gets a 403 with the code not_entitled. Here the key only has fixtures:read.
Step: Handle a missing ability, from "Errors" in the OddsYorkie API documentation.
Write code in this project that does this step and prints or uses the result.
Request: GET https://odds-feed.on-forge.com/api/v2/odds?matches=0199c5a0-7b1e-7c3a-9f4e-2d6b8a1c4e70
Read the key from the ODDSYORKIE_KEY environment variable and send it as "Authorization: Bearer <key>". Never write the key into code.
Read https://odds-feed.on-forge.com/docs/errors.md for this step first. Then read https://odds-feed.on-forge.com/docs/llms-full.txt for the rest of the API and https://odds-feed.on-forge.com/docs/AGENTS.md for the rules to follow.
Step: Handle a missing record, from "Errors" in the OddsYorkie API documentation.
Write code in this project that does this step and prints or uses the result.
Request: GET https://odds-feed.on-forge.com/api/v2/matches/0199c5a0-0000-7000-8000-00000000dead
Read the key from the ODDSYORKIE_KEY environment variable and send it as "Authorization: Bearer <key>". Never write the key into code.
Read https://odds-feed.on-forge.com/docs/errors.md for this step first. Then read https://odds-feed.on-forge.com/docs/llms-full.txt for the rest of the API and https://odds-feed.on-forge.com/docs/AGENTS.md for the rules to follow.
Response
{"error": {"status": 404,
"code": "match_not_found",
"message": "No match has this id."}}
4. Decide whether to retry
Status
Retry
400, 401, 403, 404
No. Change the request, the key or the plan.
429
Yes, after the seconds in Retry-After. See Rate limits.