Use something a person holds
curl --request POST \
--url https://api.getlurk.com/v1/units/use \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"user": "ben@example.com",
"unit": "coffee-voucher",
"amount": 1,
"reason": "Table 4",
"reference": "scan-20931"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user: 'ben@example.com',
unit: 'coffee-voucher',
amount: 1,
reason: 'Table 4',
reference: 'scan-20931'
})
};
fetch('https://api.getlurk.com/v1/units/use', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.getlurk.com/v1/units/use"
payload = {
"user": "ben@example.com",
"unit": "coffee-voucher",
"amount": 1,
"reason": "Table 4",
"reference": "scan-20931"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "act_01m6rdz548efv8pbat133yqwep",
"user": {
"id": "usr_01m40d9ax0e2vrtmq9mk0z6t00",
"external_id": "ben@example.com"
},
"unit": "coffee-voucher",
"amount": 1,
"balance_after": 1,
"reference": "scan-20931"
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}Units
Use something a person holds
Redeems an amount (one by default) of a unit a person holds, all or nothing. The unit needs usable on. A reference is used once per unit. Fires unit.used. Unknown person or unit: not_found. Owners and admins, or a project key; never an agent. Using
POST
/
v1
/
units
/
use
Use something a person holds
curl --request POST \
--url https://api.getlurk.com/v1/units/use \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"user": "ben@example.com",
"unit": "coffee-voucher",
"amount": 1,
"reason": "Table 4",
"reference": "scan-20931"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user: 'ben@example.com',
unit: 'coffee-voucher',
amount: 1,
reason: 'Table 4',
reference: 'scan-20931'
})
};
fetch('https://api.getlurk.com/v1/units/use', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.getlurk.com/v1/units/use"
payload = {
"user": "ben@example.com",
"unit": "coffee-voucher",
"amount": 1,
"reason": "Table 4",
"reference": "scan-20931"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "act_01m6rdz548efv8pbat133yqwep",
"user": {
"id": "usr_01m40d9ax0e2vrtmq9mk0z6t00",
"external_id": "ben@example.com"
},
"unit": "coffee-voucher",
"amount": 1,
"balance_after": 1,
"reference": "scan-20931"
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}Authorizations
Headers
Body
application/json
Response
Use something a person holds