> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dokstamp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Open Badges

> Issue W3C-compliant Open Badges alongside certificates for courses that have badges enabled.

# Open Badges

DokStamp supports the [Open Badges 2.0](https://www.imsglobal.org/sites/default/files/Badges/OBv2p0Final/index.html) specification. When enabled on an institution, courses can emit digital badges that students can carry in badge backpacks (Badgr, Credly, etc.) and display on LinkedIn or CVs.

***

## Enable badges on an institution

Set `is_badges_enabled: true` and provide a `badge_image_uuid` (the institution's badge image file):

```bash theme={null}
# First upload the badge image
FILE=$(curl -s -X POST https://api.dokstamp.com/files \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Accept: application/json" \
  -H "X-Tenant: {TENANT}" \
  -F "files[]=@institution-badge.png")

BADGE_IMAGE_UUID=$(echo $FILE | jq -r '.data[0].uuid')

# Enable badges on the institution
curl -X PATCH "https://api.dokstamp.com/institutions/{institution_uuid}" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Tenant: {TENANT}" \
  -d "{
    \"is_badges_enabled\": true,
    \"badge_image_uuid\": \"$BADGE_IMAGE_UUID\"
  }"
```

***

## Set a badge image on a course

Upload a course-specific badge image and attach it:

```bash theme={null}
# Upload the course badge image
FILE=$(curl -s -X POST https://api.dokstamp.com/files \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Accept: application/json" \
  -H "X-Tenant: {TENANT}" \
  -F "files[]=@bcs-badge.png")

BADGE_IMAGE_UUID=$(echo $FILE | jq -r '.data[0].uuid')

# Link it to the course
curl -X PATCH "https://api.dokstamp.com/courses/{course_uuid}" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Tenant: {TENANT}" \
  -d "{ \"badge_image_uuid\": \"$BADGE_IMAGE_UUID\" }"
```

***

## Get the badge issuer profile

```http theme={null}
GET /institutions/{uuid}/badges/issuers
```

Returns the Open Badges 2.0 Issuer Profile JSON-LD. This URL is referenced inside badge assertions to identify the issuing institution.

```json theme={null}
{
  "@context": "https://w3id.org/openbadges/v2",
  "type": "Issuer",
  "id": "https://api.dokstamp.com/institutions/550e8400.../badges/issuers",
  "name": "Federal University of Technology",
  "url": "https://fut.edu.br",
  "email": "badges@fut.edu.br"
}
```

***

## Get the course badge image

```http theme={null}
GET /courses/{uuid}/badges/image
```

Returns the badge image file. This is the visual representation of the badge.

***

## Get the badge assertion for a certificate

```http theme={null}
GET /certificates/{uuid}/badges/assertions
```

Returns a W3C Open Badges 2.0 [BadgeAssertion](https://www.imsglobal.org/sites/default/files/Badges/OBv2p0Final/index.html#Assertion) for the certificate:

```json theme={null}
{
  "@context": "https://w3id.org/openbadges/v2",
  "type": "Assertion",
  "id": "https://api.dokstamp.com/certificates/a1b2c3d4.../badges/assertions",
  "recipient": {
    "type": "email",
    "hashed": true,
    "salt": "deadsea",
    "identity": "sha256$..."
  },
  "badge": {
    "type": "BadgeClass",
    "id": "https://api.dokstamp.com/courses/c3d4e5f6.../badges",
    "name": "Bachelor of Computer Science",
    "description": "Awarded for completing the 4-year BCS program.",
    "image": "https://api.dokstamp.com/courses/c3d4e5f6.../badges/image",
    "criteria": { "narrative": "Completion of 3200-hour curriculum with passing grades." },
    "issuer": "https://api.dokstamp.com/institutions/550e8400.../badges/issuers"
  },
  "verification": { "type": "hosted" },
  "issuedOn": "2024-12-01T00:00:00Z"
}
```

***

## Badge baking

Open Badges can be "baked" into a PNG image — the assertion JSON is embedded in the image metadata. Students can then upload a single PNG file to any badge backpack for instant verification. Contact your DokStamp account manager to enable automatic badge baking on certificate issuance.

***

## LinkedIn sharing

The `public_verification_url` from a certificate can be added as a LinkedIn "Licence & Certification" with the certificate UUID as the credential ID. Employers can verify the credential directly from LinkedIn.
