To call FlightHub 2 OpenAPI, you need to carry x-user-token in the Header of each request for identity authentication and permission verification.Obtaining the Token#
x-user-token is the organization-dimension OpenAPI key (JWT ticket), obtained in the FlightHub 2 console under "My Organization → Organization Settings → OpenAPI → Copy Key". After copying, use it as the x-user-token Header value for all subsequent OpenAPI requests.Notes#
x-user-token is a JWT ticket and can be parsed with JWT Decoder to read the organization, user, expiration time, etc. from the payload.The FlightHub 2 console supports refreshing the organization key at any time. After the key is refreshed, the old key becomes invalid immediately.
When the user to whom the organization key belongs has no permission for the target project, the request will be rejected. Please verify in the FlightHub 2 console: ① whether the user has been added to the target project; ② whether the user's role in the project has the corresponding operation permission.
Common Authentication Failure Troubleshooting#
| Symptom | Possible Cause | Recommended Handling |
|---|
| HTTP 401 | Token missing / invalid / expired / already refreshed | Re-copy the latest organization key from the FlightHub 2 console |
| HTTP 403 | Token verification passed, but the current user has no permission for the resource | Add the user to the target project in the FlightHub 2 console and grant the required role |
For the complete definition of error codes, see Error Codes.Interface Usage Flow#
The following describes the complete chain taking loading a project and calling a project-level interface as an example:1.
Console preparation: Manually create the organization, project, and complete device binding in the FlightHub 2 console. OpenAPI only performs queries / calls and does not support creating organizations.
2.
Obtain the key: Enter "My Organization → Organization Settings → OpenAPI" to copy the organization key (JWT) as the x-user-token Header value for all subsequent requests.
3.
Get the project UUID: org_uuid can be obtained by parsing the JWT payload, then call GET /openapi/v2.0/manage/api/v1/organizations/{uuid}/projects to obtain the project list under the organization data.list[*].uuid as proj_uuid.
4.
Call the business interface: Carry the {proj_uuid} / {workspace_id} path parameters in the URL of subsequent business interfaces and carry x-user-token in the Header (some interfaces also require X-Project-Uuid, see Public Parameters) to call specific business capabilities.
Modified at 2026-06-15 14:32:25