Create help-desk requests from your app
Connect your client's own system — for example their service desk — to a project's help desk. It creates requests with files, reads their status and replies, with no person's account.
A help-desk token acts as one connection: one project, one client organisation and one read scope. Every call stays inside that connection.
#Before you start
- An Admin creates the connection in Administration › Help desk: the client organisation, the project, the abilities (
requests:create,requests:read,requests:reply,files:upload) and the read scope —own(the requests that this connection made) ororganisation(every request of the client in the project). - The Admin issues the token. It starts with
kanso_hdt_and shows one time. Keep it in a secret store. - Help desk must be on for the project, and its request form must be on for a create.
export API="https://app.youniton.example/api/v1/help-desk"
export AUTH="Authorization: Bearer $YOUNITON_HELPDESK_TOKEN" # kanso_hdt_… — shown one time in Administration › Help deskSend only the Authorization header: the token names the tenant, the connection and its project.
#The flow
#Read the form
The form of the connection's project gives the categories and the fields that a request needs.
GET /help-desk/form curl -s -H "$AUTH" -H 'Accept: application/json' "$API/form"GET
/help-desk/form— needsrequests:readorrequests:create.#Start an upload (optional)
To attach a file, start an upload intent. The target is
request_draftfor a new request, orrequestwith arequestKeyfor a reply.POST /help-desk/uploads curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' -H "Idempotency-Key: $(uuidgen)" "$API/uploads" \ --data '{"target":{"type":"request_draft"},"fileName":"receipt.pdf","sizeBytes":182044,"mimeType":"application/pdf"}' # → 201 data.fileId, data.put.url, data.put.headersPOST
/help-desk/uploads— needsfiles:upload.#Send the file with one PUT
Send the bytes to the presigned URL with one
PUT. Send each header ofdata.put.headerswith it. The URL is valid for 15 minutes. Do not send your Youniton token to this URL.PUT to the presigned URL curl -s -X PUT -H 'Content-Type: application/pdf' --data-binary @receipt.pdf '<data.put.url>'#Complete the upload
POST /help-desk/uploads/{fileId}/complete curl -s -X POST -H "$AUTH" -H "Idempotency-Key: $(uuidgen)" "$API/uploads/<fileId>/complete"Youniton starts the malware scan. POST
/help-desk/uploads/{fileId}/complete#Create the request
Send the category, the texts, your own
externalReference, the completedfileIdsand the person at the client who reported it.curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' \ -H "Idempotency-Key: $(uuidgen)" "$API/requests" --data '{ "categoryKey": "website_bug", "summary": "Gift cards cannot be applied", "description": "A gift card code is refused at checkout.", "impact": "urgent", "externalReference": "orbit-desk:case:88412", "fileIds": ["<fileId>"], "reporter": {"name": "Sam Lee", "email": "[email protected]", "externalId": "orbit-desk-user-4471"} }' # → 201 {"data": {"key": "ORB-R22", "status": "in_review", …}}const res = await fetch("https://app.youniton.example/api/v1/help-desk/requests", { method: "POST", headers: { Authorization: `Bearer ${process.env.YOUNITON_HELPDESK_TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID(), }, body: JSON.stringify({ categoryKey: "website_bug", summary: "Gift cards cannot be applied", description: "A gift card code is refused at checkout.", impact: "urgent", externalReference: "orbit-desk:case:88412", fileIds: [fileId], reporter: { name: "Sam Lee", email: "[email protected]", externalId: "orbit-desk-user-4471" }, }), }); const { data } = await res.json(); // res.status 201 (new) or 200 (the same reference and body)import os, uuid, requests res = requests.post( "https://app.youniton.example/api/v1/help-desk/requests", headers={ "Authorization": f"Bearer {os.environ['YOUNITON_HELPDESK_TOKEN']}", "Idempotency-Key": str(uuid.uuid4()), }, json={ "categoryKey": "website_bug", "summary": "Gift cards cannot be applied", "description": "A gift card code is refused at checkout.", "impact": "urgent", "externalReference": "orbit-desk:case:88412", "fileIds": [file_id], "reporter": {"name": "Sam Lee", "email": "[email protected]", "externalId": "orbit-desk-user-4471"}, }, ) request_key = res.json()["data"]["key"]<?php $res = $client->post('https://app.youniton.example/api/v1/help-desk/requests', [ 'headers' => [ 'Authorization' => 'Bearer ' . getenv('YOUNITON_HELPDESK_TOKEN'), 'Idempotency-Key' => bin2hex(random_bytes(16)), ], 'json' => [ 'categoryKey' => 'website_bug', 'summary' => 'Gift cards cannot be applied', 'description' => 'A gift card code is refused at checkout.', 'impact' => 'urgent', 'externalReference' => 'orbit-desk:case:88412', 'fileIds' => [$fileId], 'reporter' => ['name' => 'Sam Lee', 'email' => '[email protected]', 'externalId' => 'orbit-desk-user-4471'], ], ]); $requestKey = json_decode((string) $res->getBody(), true)['data']['key'];The same
externalReferenceagain gives the same request (200), never a second one. With another body it answers409 help_desk_request.external_reference_existswith the existingrequestKey. POST/help-desk/requests#Read it back, follow it and reply
Reads and a reply curl -s -H "$AUTH" "$API/requests/ORB-R22" curl -s -H "$AUTH" "$API/requests?status=all" # meta.changeCursor → ?changeCursor=… for the next page or poll curl -s -H "$AUTH" "$API/requests/ORB-R22/messages" curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' -H "Idempotency-Key: $(uuidgen)" \ "$API/requests/ORB-R22/messages" --data '{"body":"It also fails on iPad."}'- GET
/help-desk/requests/{requestKey}One request as the connection reads it - GET
/help-desk/requestsThe requests that the connection can read, oldest update first - GET
/help-desk/requests/{requestKey}/messagesThe client-visible messages, oldest first - POST
/help-desk/requests/{requestKey}/messagesReply on a request from the client's system - GET
/help-desk/requests/{requestKey}/files/{fileId}/downloadRedirect to a 60-second signed URL of a file that the connection can read
The list is a poll: read the change cursor. A file download answers
302to a signed URL that is valid for 60 seconds.- GET
#Withdraw it (optional)
POST /help-desk/requests/{requestKey}/withdraw curl -s -X POST -H "$AUTH" -H "Idempotency-Key: $(uuidgen)" "$API/requests/ORB-R22/withdraw"Only the connection that made the request can withdraw it, and only while it is open (
403 access.forbiddenwithreason: not_requester). POST/help-desk/requests/{requestKey}/withdraw
#What each refusal means
| Answer | Meaning |
|---|---|
401 auth.unauthenticated | the token is wrong, expired or revoked, or the connection is revoked |
403 help_desk.ability_missing | the connection does not have the ability of the operation |
403 help_desk.connection_paused | an Admin paused the connection |
403 help_desk.unavailable | help desk or its form is off for the project |
404 help_desk_request.not_found | the request is not of the connection's project and client, or not in its read scope |
409 help_desk_request.external_reference_exists | the external reference names a request with another body |
429 rate_limit.exceeded | too many calls, creates or uploads; wait for Retry-After |
#What the team sees
Each request shows in the project's Help desk queue as API connection · <connection name>. When the reporter's e-mail is the e-mail of a portal guest of the same client, the request shows in that guest's portal list as theirs. Youniton never e-mails a reporter: your system learns of changes by polling or by webhooks.
#Get changes by webhook
A connection can subscribe its client's system to request events: request.created, request.updated, request.message_posted, request.decided and request.closed. A connection never gets an event for its own action. The payload holds the request as the connection may read it, without the description and the field values: read them with GET/help-desk/requests/{requestKey}. Read Receive Youniton webhooks.
Was this helpful?