Achievements
Mark an achievement as completed
Mark an achievement as completed for a user.
POST
/
achievements
/
{key}
/
complete
Copy
curl --request POST \
--url https://app.trophy.so/api/achievements/{key}/complete \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '{
"user": {
"title": "User",
"type": "object",
"description": "A user of your application.",
"allOf": [
{
"title": "Upserted User",
"type": "object",
"description": "An object with editable user fields.",
"allOf": [
{
"title": "Updated User",
"type": "object",
"description": "An object with editable user fields.",
"properties": {
"email": {
"type": "string",
"description": "The user'\''s email address. Required if subscribeToEmails is true.",
"example": "user@example.com"
},
"name": {
"type": "string",
"description": "The name to refer to the user by in emails.",
"example": "User"
},
"tz": {
"type": "string",
"description": "The user'\''s timezone (used for email scheduling).",
"example": "Europe/London"
},
"subscribeToEmails": {
"type": "boolean",
"default": true,
"description": "Whether the user should receive Trophy-powered emails. Cannot be false if an email is provided.",
"example": true
}
}
},
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The ID of the user in your database. Must be a string.",
"example": "user-id"
}
},
"required": [
"id"
]
}
]
},
{
"type": "object",
"properties": {
"control": {
"type": "boolean",
"description": "Whether the user is in the control group, meaning they do not receive emails or other communications from Trophy.",
"example": false
},
"created": {
"type": "string",
"format": "date-time",
"description": "The date and time the user was created, in ISO 8601 format.",
"example": "2021-01-01T00:00:00Z"
},
"updated": {
"type": "string",
"format": "date-time",
"description": "The date and time the user was last updated, in ISO 8601 format.",
"example": "2021-01-01T00:00:00Z"
}
}
}
]
}
}'
Copy
{
"completionId": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"achievement": {
"id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
"trigger": "api",
"name": "Finish onboarding",
"description": "Complete the onboarding process.",
"badgeUrl": "https://example.com/badge.png",
"key": "finish-onboarding",
"achievedAt": "2021-01-01T00:00:00Z"
}
}
Authorizations
Path Parameters
Unique reference of the achievement as set when created.
Body
application/json
Response
201
application/json
Successful operation
The response is of type object
.
Was this page helpful?
Copy
curl --request POST \
--url https://app.trophy.so/api/achievements/{key}/complete \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '{
"user": {
"title": "User",
"type": "object",
"description": "A user of your application.",
"allOf": [
{
"title": "Upserted User",
"type": "object",
"description": "An object with editable user fields.",
"allOf": [
{
"title": "Updated User",
"type": "object",
"description": "An object with editable user fields.",
"properties": {
"email": {
"type": "string",
"description": "The user'\''s email address. Required if subscribeToEmails is true.",
"example": "user@example.com"
},
"name": {
"type": "string",
"description": "The name to refer to the user by in emails.",
"example": "User"
},
"tz": {
"type": "string",
"description": "The user'\''s timezone (used for email scheduling).",
"example": "Europe/London"
},
"subscribeToEmails": {
"type": "boolean",
"default": true,
"description": "Whether the user should receive Trophy-powered emails. Cannot be false if an email is provided.",
"example": true
}
}
},
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The ID of the user in your database. Must be a string.",
"example": "user-id"
}
},
"required": [
"id"
]
}
]
},
{
"type": "object",
"properties": {
"control": {
"type": "boolean",
"description": "Whether the user is in the control group, meaning they do not receive emails or other communications from Trophy.",
"example": false
},
"created": {
"type": "string",
"format": "date-time",
"description": "The date and time the user was created, in ISO 8601 format.",
"example": "2021-01-01T00:00:00Z"
},
"updated": {
"type": "string",
"format": "date-time",
"description": "The date and time the user was last updated, in ISO 8601 format.",
"example": "2021-01-01T00:00:00Z"
}
}
}
]
}
}'
Copy
{
"completionId": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"achievement": {
"id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
"trigger": "api",
"name": "Finish onboarding",
"description": "Complete the onboarding process.",
"badgeUrl": "https://example.com/badge.png",
"key": "finish-onboarding",
"achievedAt": "2021-01-01T00:00:00Z"
}
}
Assistant
Responses are generated using AI and may contain mistakes.