# Credits

Credit management and retrieval

## Get user credits

> Returns all credits for a specific user with their current status. \
> Returns 401 if the user is flagged for multi-accounting or captcha violations.<br>

```json
{"openapi":"3.1.0","info":{"title":"Credits Server API","version":"1.0.0"},"tags":[{"name":"Credits","description":"Credit management and retrieval"}],"servers":[{"url":"https://credits.decentraland.org","description":"Production environment","variables":{}},{"url":"https://credits.decentraland.zone","description":"Development environment","variables":{}}],"security":[],"paths":{"/users/{address}/credits":{"get":{"tags":["Credits"],"summary":"Get user credits","description":"Returns all credits for a specific user with their current status. \nReturns 401 if the user is flagged for multi-accounting or captcha violations.\n","operationId":"getCredits","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"User's Ethereum address"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["AVAILABLE","PARTIALLY_USED"]},"description":"Filter credits by status. If not provided, returns AVAILABLE and PARTIALLY_USED credits"}],"responses":{"200":{"description":"User credits retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"credits":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Credit ID (UUID)"},"amount":{"type":"number","description":"Credit amount in MANA"},"status":{"type":"string","enum":["AVAILABLE","PARTIALLY_USED","USED","EXPIRED"],"description":"Credit status"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"expiresAt":{"type":"string","format":"date-time","description":"Expiration timestamp (based on season end date)"},"signature":{"type":"string","description":"Credit signature for on-chain verification"},"seasonId":{"type":"number","description":"Associated season ID"},"goalId":{"type":"string","description":"Goal ID that granted this credit"}},"required":["id","amount","status"]},"description":"List of user credits"},"totalCredits":{"type":"number","description":"Total available credits amount"}},"required":["credits","totalCredits"]}}}},"400":{"description":"Bad request - Invalid address format","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code (optional)"}},"required":["error"]}}}},"401":{"description":"User is flagged - The user has been flagged for multi-accounting or captcha violations","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"},"reason":{"type":"object","properties":{"message":{"type":"string"},"ip":{"type":"string"},"linkedAddresses":{"type":"array","items":{"type":"string"}}}},"isBlockedForClaiming":{"type":"boolean"}}}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code (optional)"}},"required":["error"]}}}}}}}}}
```

## Get credits stream (SSE)

> Server-sent events endpoint for real-time credit balance updates. \
> Provides a persistent connection that streams credit updates as they occur.<br>

```json
{"openapi":"3.1.0","info":{"title":"Credits Server API","version":"1.0.0"},"tags":[{"name":"Credits","description":"Credit management and retrieval"}],"servers":[{"url":"https://credits.decentraland.org","description":"Production environment","variables":{}},{"url":"https://credits.decentraland.zone","description":"Development environment","variables":{}}],"security":[],"paths":{"/users/{address}/credits/stream":{"get":{"tags":["Credits"],"summary":"Get credits stream (SSE)","description":"Server-sent events endpoint for real-time credit balance updates. \nProvides a persistent connection that streams credit updates as they occur.\n","operationId":"getCreditsStream","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"User's Ethereum address"}],"responses":{"200":{"description":"Server-sent events stream","content":{"text/event-stream":{"schema":{"type":"string","description":"SSE stream with credit updates in event stream format"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code (optional)"}},"required":["error"]}}}}}}}}}
```
