Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add error code documentation to API reference

Kiran K06b22cf37d05
diff --git a/apps/docs/api-reference/errors.mdx b/apps/docs/api-reference/errors.mdx
new file mode 100644
index 0000000000..e73007b4e3
--- /dev/null
+++ b/apps/docs/api-reference/errors.mdx
@@ -0,0 +1,68 @@
+---
+title: "Errors"
+"og:title": "Dub.co API returns machine readable error codes, human readable error messages and a link to the docs for more information"
+description: "Troubleshoot problems with this comprehensive breakdown of all error codes."
+---
+
+Dub.co API returns machine readable error codes, human readable error messages and a link to the docs for more information.
+
+Here is how an error response looks like:
+
+```json
+{
+ "error": {
+ "code": "not_found",
+ "message": "The requested resource was not found.",
+ "doc_url": "https://dub.co/docs/api-reference/errors#not_found"
+ }
+}
+```
+
+## Error Codes
+
+Here is a list of all error codes Dub.co API returns:
+
+### `bad_request`
+
+- **Problem:** The request is malformed, either missing required fields, using wrong datatypes, or being syntactically incorrect.
+- **Solution:** Check the request and make sure it is properly formatted.
+
+### `unauthorized`
+
+- **Problem:** The request has not been applied because it lacks valid authentication credentials for the target resource.
+- **Solution:** Make sure you are using the correct API key or access token.
+
+### `forbidden`
+
+- **Problem:** The server understood the request, but is refusing to fulfill it because the client lacks proper permission.
+- **Solution:** Make sure you have the necessary permissions to access the resource.
+
+### `not_found`
+
+- **Problem:** The server has not found anything matching the request URI.
+- **Solution:** Check the request and make sure the resource exists.
+
+### `conflict`
+
+- **Problem:** Another resource already uses the same identifier. For example, project slug must be unique.
+- **Solution:** Change the identifier to a unique value.
+
+### `invite_expired`
+
+- **Problem:** The invite has expired.
+- **Solution:** Generate a new invite.
+
+### `unprocessable_entity`
+
+- **Problem:** The server was unable to process the request because it contains invalid data.
+- **Solution:** Check the request and make sure input data is valid.
+
+### `rate_limit_exceeded`
+
+- **Problem:** The request has been rate limited.
+- **Solution:** Wait for a while and try again.
+
+### `internal_server_error`
+
+- **Problem:** The server encountered an unexpected condition that prevented it from fulfilling the request.
+- **Solution:** Try again later. If the problem persists, contact support.
diff --git a/apps/docs/mint.json b/apps/docs/mint.json
index 0ca4007e52..cc1373c1a2 100644
--- a/apps/docs/mint.json
+++ b/apps/docs/mint.json
@@ -69,7 +69,11 @@
},
{
"group": "API Reference",
- "pages": ["api-reference/introduction", "api-reference/rate-limits"]
+ "pages": [
+ "api-reference/introduction",
+ "api-reference/rate-limits",
+ "api-reference/errors"
+ ]
},
{
"group": "Links",