Community Badges
Create Badge
Create a badge for a community. Badges are used to enable on-chain attestations of achievements, events, and more.
POST
/
community
/
{id}
/
badge
Create badge
curl --request POST \
--url https://api.openpage.fun/v1/community/{id}/badge \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"title": "<string>",
"image": "<string>",
"description": "<string>",
"claimEndDate": "2023-11-07T05:31:56Z",
"maxClaims": 123,
"tags": [
{
"id": "<string>",
"name": "<string>"
}
],
"author": {
"name": "<string>",
"uri": "<string>"
},
"status": "live",
"chainId": "11155111",
"contract": "<string>"
}
'import requests
url = "https://api.openpage.fun/v1/community/{id}/badge"
payload = {
"title": "<string>",
"image": "<string>",
"description": "<string>",
"claimEndDate": "2023-11-07T05:31:56Z",
"maxClaims": 123,
"tags": [
{
"id": "<string>",
"name": "<string>"
}
],
"author": {
"name": "<string>",
"uri": "<string>"
},
"status": "live",
"chainId": "11155111",
"contract": "<string>"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
image: '<string>',
description: '<string>',
claimEndDate: '2023-11-07T05:31:56Z',
maxClaims: 123,
tags: [{id: '<string>', name: '<string>'}],
author: {name: '<string>', uri: '<string>'},
status: 'live',
chainId: '11155111',
contract: '<string>'
})
};
fetch('https://api.openpage.fun/v1/community/{id}/badge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openpage.fun/v1/community/{id}/badge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'image' => '<string>',
'description' => '<string>',
'claimEndDate' => '2023-11-07T05:31:56Z',
'maxClaims' => 123,
'tags' => [
[
'id' => '<string>',
'name' => '<string>'
]
],
'author' => [
'name' => '<string>',
'uri' => '<string>'
],
'status' => 'live',
'chainId' => '11155111',
'contract' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openpage.fun/v1/community/{id}/badge"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"image\": \"<string>\",\n \"description\": \"<string>\",\n \"claimEndDate\": \"2023-11-07T05:31:56Z\",\n \"maxClaims\": 123,\n \"tags\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"author\": {\n \"name\": \"<string>\",\n \"uri\": \"<string>\"\n },\n \"status\": \"live\",\n \"chainId\": \"11155111\",\n \"contract\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openpage.fun/v1/community/{id}/badge")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"image\": \"<string>\",\n \"description\": \"<string>\",\n \"claimEndDate\": \"2023-11-07T05:31:56Z\",\n \"maxClaims\": 123,\n \"tags\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"author\": {\n \"name\": \"<string>\",\n \"uri\": \"<string>\"\n },\n \"status\": \"live\",\n \"chainId\": \"11155111\",\n \"contract\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openpage.fun/v1/community/{id}/badge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"image\": \"<string>\",\n \"description\": \"<string>\",\n \"claimEndDate\": \"2023-11-07T05:31:56Z\",\n \"maxClaims\": 123,\n \"tags\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"author\": {\n \"name\": \"<string>\",\n \"uri\": \"<string>\"\n },\n \"status\": \"live\",\n \"chainId\": \"11155111\",\n \"contract\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyWhen creating badges you can make use of Community Files to upload images and and use the OpenPage image cdn as the source URL.
For IPFS images an easy and cost effective solution is to use a service like Pinata to upload and pin the IPFS image.
New Badges created via the API are marked as
approved by default. To begin creating badge attributions you will need to update the status to live using the Update Badge endpoint. Once Badges are set to live they will be visible publicly on OpenPage and across the OpenPage ecosystem.Approved badges can be previewed at:
https://openpage.fun/badges/{badgeId}Authorizations
Path Parameters
Community ID
Body
application/json
The image URL of the badge. Can be an IPFS url or OpenPage File.
Available options:
achievement, attendance Array of tags. Members with matching tags are eligible to claim the badge.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
draft, under_review, approved, rejected, live Example:
"live"
The chain ID of the badge.
Example:
"11155111"
Response
201 - undefined
⌘I
Create badge
curl --request POST \
--url https://api.openpage.fun/v1/community/{id}/badge \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"title": "<string>",
"image": "<string>",
"description": "<string>",
"claimEndDate": "2023-11-07T05:31:56Z",
"maxClaims": 123,
"tags": [
{
"id": "<string>",
"name": "<string>"
}
],
"author": {
"name": "<string>",
"uri": "<string>"
},
"status": "live",
"chainId": "11155111",
"contract": "<string>"
}
'import requests
url = "https://api.openpage.fun/v1/community/{id}/badge"
payload = {
"title": "<string>",
"image": "<string>",
"description": "<string>",
"claimEndDate": "2023-11-07T05:31:56Z",
"maxClaims": 123,
"tags": [
{
"id": "<string>",
"name": "<string>"
}
],
"author": {
"name": "<string>",
"uri": "<string>"
},
"status": "live",
"chainId": "11155111",
"contract": "<string>"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
image: '<string>',
description: '<string>',
claimEndDate: '2023-11-07T05:31:56Z',
maxClaims: 123,
tags: [{id: '<string>', name: '<string>'}],
author: {name: '<string>', uri: '<string>'},
status: 'live',
chainId: '11155111',
contract: '<string>'
})
};
fetch('https://api.openpage.fun/v1/community/{id}/badge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openpage.fun/v1/community/{id}/badge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'image' => '<string>',
'description' => '<string>',
'claimEndDate' => '2023-11-07T05:31:56Z',
'maxClaims' => 123,
'tags' => [
[
'id' => '<string>',
'name' => '<string>'
]
],
'author' => [
'name' => '<string>',
'uri' => '<string>'
],
'status' => 'live',
'chainId' => '11155111',
'contract' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openpage.fun/v1/community/{id}/badge"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"image\": \"<string>\",\n \"description\": \"<string>\",\n \"claimEndDate\": \"2023-11-07T05:31:56Z\",\n \"maxClaims\": 123,\n \"tags\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"author\": {\n \"name\": \"<string>\",\n \"uri\": \"<string>\"\n },\n \"status\": \"live\",\n \"chainId\": \"11155111\",\n \"contract\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openpage.fun/v1/community/{id}/badge")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"image\": \"<string>\",\n \"description\": \"<string>\",\n \"claimEndDate\": \"2023-11-07T05:31:56Z\",\n \"maxClaims\": 123,\n \"tags\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"author\": {\n \"name\": \"<string>\",\n \"uri\": \"<string>\"\n },\n \"status\": \"live\",\n \"chainId\": \"11155111\",\n \"contract\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openpage.fun/v1/community/{id}/badge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"image\": \"<string>\",\n \"description\": \"<string>\",\n \"claimEndDate\": \"2023-11-07T05:31:56Z\",\n \"maxClaims\": 123,\n \"tags\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"author\": {\n \"name\": \"<string>\",\n \"uri\": \"<string>\"\n },\n \"status\": \"live\",\n \"chainId\": \"11155111\",\n \"contract\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body