> For the complete documentation index, see [llms.txt](https://village-labs.gitbook.io/coworker-product-and-developer-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://village-labs.gitbook.io/coworker-product-and-developer-docs/legacy-developer-docs/village-apis-introduction/redemption-api.md).

# Redemption API

{% hint style="info" %}
[**Is this page helpful? Give us feedback on our docs ->**](/coworker-product-and-developer-docs/feedback/village-docs-feedback-form.md) [ ](/coworker-product-and-developer-docs/feedback/village-docs-feedback-form.md)
{% endhint %}

## About Redemption

The Redemption API enables you to expend (or "burn") end-user asset (called an Award in the user and admin dashboards), while logging what they were redeemed for, such as a discount on a purchase. Functional use cases include:&#x20;

1. Redeeming store credits during the check out flow
2. Redeeming loyalty points for perks, like an upgrade to a first-class seat

Although the [Master Award Control -> Burn API](/coworker-product-and-developer-docs/legacy-developer-docs/village-apis-introduction/master-award-controls.md) also offers the option to effectively delete assets from the Village Ledger, the Redemption API is the preferred method for use cases in which users are trading their assets for something else, because it allows you to log what they were redeeming those asset for.&#x20;

To see more about real-world Redemption use cases, check out our [Guides->](broken://pages/5d8qrBOAvNKzJ6LXdQck).&#x20;

{% hint style="info" %}
**Important:** in order to be redeemed using the Redemption API, awards need to be created as 'non-monetary award' types. Status & Badges cannot be burned/redeemed.&#x20;
{% endhint %}

## Endpoint

**`POST`**`/networks/YOUR_NETWORK_ID/redemption`

Where 'YOUR\_NETWORK\_ID' is replaced with your actual Network ID.&#x20;

## API Field Overview

### Body Fields

<table><thead><tr><th width="140">Field Name</th><th width="184">JSON Key</th><th>Type</th><th width="466">Description</th><th>Required</th></tr></thead><tbody><tr><td>User</td><td>user</td><td>string</td><td>The user. May be email or user_id.</td><td>Yes</td></tr><tr><td>Asset Short Name</td><td>asset_short_name</td><td>string</td><td>Short Name of the asset to be redeemed. This is the same Short Name created and viewable on the Village admin dashboard.</td><td>Yes</td></tr><tr><td>Amount</td><td>amount</td><td>string</td><td>Amount to be redeemed.</td><td>Yes</td></tr><tr><td>Metadata</td><td>metadata</td><td>object</td><td>Additional metadata. See Metadata fields for options.</td><td>No</td></tr></tbody></table>

### Metadata

<table><thead><tr><th width="144">Field Name</th><th width="207">JSON Key</th><th>Type</th><th width="633">Description</th><th>Required</th></tr></thead><tbody><tr><td>Reference ID</td><td>reference_id</td><td>string</td><td>An optional identifier that can be used for reporting purposes.</td><td>No</td></tr><tr><td>Redemption Timestamp</td><td>redemption_timestamp</td><td>integer</td><td>The Unix timestamp of when the redemption occurred. If this is blank, Village will use the timestamp the activity was received via the Village API as the Redemption Timestamp.</td><td>No</td></tr><tr><td>Redeemed For</td><td>redeemed_for</td><td>string</td><td>An optional descriptor that can be used to record what the user received in return for the redeemed asset.</td><td>No</td></tr><tr><td>Redeemed For Amount</td><td>redeemed_for_amount</td><td>string</td><td>An optional descriptor that can be used to record the amount of something the user received in return for the redeemed asset.</td><td>No</td></tr><tr><td>Description</td><td>description</td><td>string</td><td>A description of the redemption.</td><td>No</td></tr></tbody></table>

## Examples

### Body

```
// Example Redemption Body
{
    "user": "johnny.redemption@villagelabs.co",
    "asset_short_id": "POINT",
    "amount": "100.00",
    "metadata": {
        "reference_id": "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
        "redemption_timestamp": 1664900628,
        "redeemed_for": "discount",
        "redeemed_for_amount": "15%",
        "description": "Standard 100 token for 15% discount redemption."
    }
}

```

### By Language

{% tabs %}
{% tab title="Python" %}

```python
# Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID

import requests
import json

url = "https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption"

headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

data = {
    "user": "johnny.redemption@villagelabs.co",
    "asset_short_name": "POINT",
    "amount": "100.00",
    "metadata": {
        "reference_id": "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
        "redemption_timestamp": 1664900628,
        "redeemed_for": "discount",
        "redeemed_for_amount": "15%",
        "description": "Standard 100 token for 15% discount redemption."
    }
}

response = requests.post(url, headers=headers, data=json.dumps(data))

print(response.json())

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
// Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID

const axios = require('axios');

const url = "https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption";

const headers = {
  "Content-Type": "application/json",
  "Accept": "application/json",
  "Authorization": "Bearer YOUR_API_KEY"
};

const data = {
  user: "johnny.redemption@villagelabs.co",
  asset_short_name: "POINT",
  amount: "100.00",
  metadata: {
    reference_id: "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
    redemption_timestamp: 1664900628,
    redeemed_for: "discount",
    redeemed_for_amount: "15%",
    description: "Standard 100 token for 15% discount redemption."
  }
};

axios.post(url, data, {headers: headers})
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.error(error);
  });

```

{% endtab %}

{% tab title="cURL" %}

```json
# Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID

curl -X POST 'https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
    "user": "johnny.redemption@villagelabs.co",
    "asset_short_name": "POINT",
    "amount": "100.00",
    "metadata": {
        "reference_id": "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
        "redemption_timestamp": 1664900628,
        "redeemed_for": "discount",
        "redeemed_for_amount": "15%",
        "description": "Standard 100 token for 15% discount redemption."
    }
}'

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
# Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption")

http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, 
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_API_KEY')

request.body = {
  user: "johnny.redemption@villagelabs.co",
  asset_short_name: "POINT",
  amount: "100.00",
  metadata: {
    reference_id: "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
    redemption_timestamp: 1664900628,
    redeemed_for: "discount",
    redeemed_for_amount: "15%",
    description: "Standard 100 token for 15% discount redemption."
  }
}.to_json

response = http.request(request)

puts response.body

```

{% endtab %}

{% tab title="Java" %}

```java
import org.json.JSONObject;
import org.json.HTTP;
import java.net.http.HttpRequest;
import java.net.http.HttpHeaders;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpResponse;
import java.net.http.HttpRequest.BodyPublishers;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();

        // Create metadata JSONObject
        JSONObject metadata = new JSONObject();
        metadata.put("reference_id", "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB");
        metadata.put("redemption_timestamp", 1664900628);
        metadata.put("redeemed_for", "discount");
        metadata.put("redeemed_for_amount", "15%");
        metadata.put("description", "Standard 100 token for 15% discount redemption.");

        // Create main JSONObject
        JSONObject redemption = new JSONObject();
        redemption.put("user", "johnny.redemption@villagelabs.co");
        redemption.put("asset_short_name", "POINT");
        redemption.put("amount", "100.00");
        redemption.put("metadata", metadata);

        // Create request
        HttpRequest request = HttpRequest.newBuilder()
                .uri(new URI("https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption"))
                .header("Content-Type", "application/json")
                .header("Accept", "application/json")
                .header("Authorization", "Bearer YOUR_API_KEY")  // Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID
                .POST(BodyPublishers.ofString(redemption.toString()))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}



```

{% endtab %}

{% tab title="Go" %}

```go
// Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID

package main

import (
	"bytes"
	"net/http"
	"fmt"
)

func main() {
	url := "https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption"
	var jsonData = []byte(`{
		"user": "johnny.redemption@villagelabs.co",
		"asset_short_name": "POINT",
		"amount": "100.00",
		"metadata": {
			"reference_id": "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
			"redemption_timestamp": 1664900628,
			"redeemed_for": "discount",
			"redeemed_for_amount": "15%",
			"description": "Standard 100 token for 15% discount redemption."
		}
	}`)

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Accept", "application/json")
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println("response Status:", resp.Status)
}

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
[**Is this page helpful? Give us feedback on our docs ->**](/coworker-product-and-developer-docs/feedback/village-docs-feedback-form.md) [ ](/coworker-product-and-developer-docs/feedback/village-docs-feedback-form.md)
{% endhint %}


---

# 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, and the optional `goal` query parameter:

```
GET https://village-labs.gitbook.io/coworker-product-and-developer-docs/legacy-developer-docs/village-apis-introduction/redemption-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
