# Codes

Referral code management

## Get user code

> Get or generate a referral code for the authenticated user

```json
{"openapi":"3.0.3","info":{"title":"Decentraland Referral Service API","version":"1.0.0"},"tags":[{"name":"Codes","description":"Referral code management"}],"servers":[{"url":"https://rewards.decentraland.org","description":"Production server"},{"url":"https://rewards.decentraland.zone","description":"Development server"},{"url":"http://localhost:8000","description":"Local Development server"}],"security":[],"paths":{"/api/code":{"get":{"tags":["Codes"],"summary":"Get user code","description":"Get or generate a referral code for the authenticated user","responses":{"200":{"description":"User referral code","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","required":["user","code","created_at","updated_at"],"properties":{"user":{"type":"string","format":"address","description":"User address"},"code":{"type":"string","description":"Referral code"},"created_at":{"type":"string","format":"date-time","description":"Code creation time"},"updated_at":{"type":"string","format":"date-time","description":"Code last update time"}}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["ok","error"],"properties":{"ok":{"type":"boolean","description":"Whether the request was successful"},"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code"},"data":{"type":"object","description":"Additional error data"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["ok","error"],"properties":{"ok":{"type":"boolean","description":"Whether the request was successful"},"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code"},"data":{"type":"object","description":"Additional error data"}}}}}}}}}}}
```
