Blame
|
1 | # Shared Responses |
||||||
| 2 | ||||||||
| 3 | <p>These may show up on any given route in any service.</p> |
|||||||
| 4 | <p>The contents of <code>error</code> & <code>message</code> are unreliable, use <code>code</code> instead. See <a href="/YiffyAPI/Error Codes">Error Codes</a> for a full list.</p> |
|||||||
| 5 | ||||||||
| 6 | ||||||||
| 7 | ::: danger |
|||||||
| 8 | # 401 Unauthorized: Invalid API Key |
|||||||
| 9 | ```json |
|||||||
| 10 | { |
|||||||
| 11 | "success": false, |
|||||||
| 12 | "code": 1010, |
|||||||
| 13 | "error": "Invalid API key." |
|||||||
| 14 | } |
|||||||
| 15 | ``` |
|||||||
| 16 | ::: |
|||||||
| 17 | ||||||||
| 18 | ::: danger |
|||||||
| 19 | # 401 Unauthorized: API Key Inactive |
|||||||
| 20 | ```json |
|||||||
| 21 | { |
|||||||
| 22 | "success": false, |
|||||||
| 23 | "code": 1011, |
|||||||
| 24 | "error": "API key is inactive." |
|||||||
| 25 | } |
|||||||
| 26 | ``` |
|||||||
| 27 | ::: |
|||||||
| 28 | ||||||||
| 29 | ::: danger |
|||||||
| 30 | # 401 Unauthorized: API Key Required |
|||||||
| 31 | ```json |
|||||||
| 32 | { |
|||||||
| 33 | "success": false, |
|||||||
| 34 | "code": 1013, |
|||||||
| 35 | "error": "An API key is required to access this service." |
|||||||
| 36 | } |
|||||||
| 37 | ``` |
|||||||
| 38 | ::: |
|||||||
| 39 | ||||||||
| 40 | ::: danger |
|||||||
| 41 | # 403 Forbidden: API Key Disabled |
|||||||
| 42 | ```json |
|||||||
| 43 | { |
|||||||
| 44 | "success": false, |
|||||||
| 45 | "code": 1012, |
|||||||
| 46 | "error": "Your API key has been disabled by an administrator. See \"extra.reason\" for the reasoning.", |
|||||||
| 47 | "extra": { |
|||||||
| 48 | "reason": "", |
|||||||
| 49 | "support": "https://yiff.rest/support" |
|||||||
| 50 | } |
|||||||
| 51 | } |
|||||||
| 52 | ``` |
|||||||
| 53 | ::: |
|||||||
| 54 | ||||||||
| 55 | ::: danger |
|||||||
| 56 | # 403 Forbidden: No Access To Service |
|||||||
| 57 | ```json |
|||||||
| 58 | { |
|||||||
| 59 | "success": false, |
|||||||
| 60 | "code": 1022, |
|||||||
| 61 | "error": "You do not have access to this service." |
|||||||
| 62 | } |
|||||||
| 63 | ``` |
|||||||
| 64 | ::: |
|||||||
| 65 | ||||||||
| 66 | ::: danger |
|||||||
| 67 | # 403 Forbidden: IP Blocked |
|||||||
| 68 | ```json |
|||||||
| 69 | { |
|||||||
| 70 | "success": false, |
|||||||
| 71 | "code": 1002, |
|||||||
| 72 | "error": "You have been blocked from accessing this service.", |
|||||||
| 73 | "extra": { |
|||||||
| 74 | "reason": "", |
|||||||
| 75 | "support": "https://yiff.rest/support" |
|||||||
| 76 | } |
|||||||
| 77 | } |
|||||||
| 78 | ``` |
|||||||
| 79 | ::: |
|||||||
| 80 | ||||||||
| 81 | ::: danger |
|||||||
| 82 | # 429 Too Many Requests: Rate Limited |
|||||||
| 83 | ```json |
|||||||
| 84 | // global headers will also be present |
|||||||
| 85 | { |
|||||||
| 86 | "success": false, |
|||||||
| 87 | "error": "Request Limit Exceeded", |
|||||||
| 88 | "code": 1000, |
|||||||
| 89 | "info": { |
|||||||
| 90 | "limit": 0, // X-RateLimit-Limit |
|||||||
| 91 | "remaining": 0, // X-RateLimit-Remaining |
|||||||
| 92 | "reset": 0, // X-RateLimit-Reset |
|||||||
| 93 | "resetAfter": 0, // X-RateLimit-Reset-After |
|||||||
| 94 | "retryAfter": 0, // Retry-After |
|||||||
| 95 | "bucket": "", // X-RateLimit-Bucket |
|||||||
| 96 | "precision": "millisecond", // X-RateLimit-Precision |
|||||||
| 97 | "global": false |
|||||||
| 98 | } |
|||||||
| 99 | } |
|||||||
| 100 | ``` |
|||||||
| 101 | ::: |
|||||||
| 102 | ||||||||
| 103 | ::: danger |
|||||||
| 104 | # 429 Too Many Requests: Globally Rate Limited |
|||||||
| 105 | ```json |
|||||||
| 106 | // route specific headers will also be present |
|||||||
| 107 | { |
|||||||
| 108 | "success": false, |
|||||||
| 109 | "error": "Request Limit Exceeded", |
|||||||
| 110 | "code": 1001, |
|||||||
| 111 | "info": { |
|||||||
| 112 | "limit": 0, // X-RateLimit-Global-Limit |
|||||||
| 113 | "remaining": 0, // X-RateLimit-Global-Remaining |
|||||||
| 114 | "reset": 0, // X-RateLimit-Global-Reset |
|||||||
| 115 | "resetAfter": 0, // X-RateLimit-Global-Reset-After |
|||||||
| 116 | "retryAfter": 0, // Retry-After |
|||||||
| 117 | "precision": "millisecond", // X-RateLimit-Global-Precision |
|||||||
| 118 | "global": true |
|||||||
| 119 | } |
|||||||
| 120 | } |
|||||||
| 121 | ``` |
|||||||
| 122 | ::: |
|||||||
| 123 | ||||||||
| 124 | ::: danger |
|||||||
| 125 | # 503 Service Unavailable: Read Only |
|||||||
| 126 | ```json |
|||||||
| 127 | { |
|||||||
| 128 | "success": false, |
|||||||
| 129 | "code": 2, |
|||||||
| 130 | "error": "This service is currently in read only mode. Try again later." |
|||||||
| 131 | } |
|||||||
| 132 | ``` |
|||||||
| 133 | ::: |
|||||||
