> For the complete documentation index, see [llms.txt](https://p00ls.gitbook.io/token-os/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://p00ls.gitbook.io/token-os/management-api/codes.md).

# Codes

Codes are used to credit users with $TOKENs.  Each code has two required parameters, a reward amount and total number of times the code can be redeemed.

### The code object

This object represents a code.  It lets you retrieve information about the code including amount, status, redemptions, and redemptions remaining.

### Retrieve code

{% openapi src="/files/0xcSTZfwttgKwkRT0eAS" path="/codes/{codeId}" method="get" %}
[creator-api.yaml](https://2025772754-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOyoBDhx8ymvd9xgu92d%2Fuploads%2FV9K5lc6vyEJK4GH14sh4%2Fcreator-api.yaml?alt=media\&token=9ea3d663-0606-4b83-a29c-d9fd58940b29)
{% endopenapi %}

### Redeem code for user

For a more seamless UX, you can instantly credit a user by redeeming a code on their behalf.

{% openapi src="/files/0xcSTZfwttgKwkRT0eAS" path="/codes/redemptions" method="post" %}
[creator-api.yaml](https://2025772754-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOyoBDhx8ymvd9xgu92d%2Fuploads%2FV9K5lc6vyEJK4GH14sh4%2Fcreator-api.yaml?alt=media\&token=9ea3d663-0606-4b83-a29c-d9fd58940b29)
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://p00ls.gitbook.io/token-os/management-api/codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
