Legion Hand Technologies Logo

Developer Portal

v1.0.0

API Reference

The User-X API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Base URL

https://api.user-x.com

Authentication

The User-X API uses API keys to authenticate requests. You can view and manage your API keys in the User-X Dashboard.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Bearer authentication. Provide your API key as the bearer token value.

Authorization: Bearer sk_test_...

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Opportunities

Opportunities represent campaigns or challenges that users can participate in.

List Opportunities

GET /api/opportunities

Returns a list of active opportunities.

Parameters

ParameterTypeDescription
limitintegerNumber of opportunities to return (1-100, default: 20)
offsetintegerNumber of opportunities to skip (default: 0)
statusstringFilter by status: active, draft, completed

Response

{
  "data": [
    {
      "id": "opp_1234567890",
      "title": "Customer Feedback Survey",
      "description": "Help us improve our services",
      "status": "active",
      "totalTasks": 3,
      "estimatedTime": 15,
      "reward": {
        "type": "voucher",
        "value": 25.00,
        "currency": "USD"
      },
      "createdAt": "2024-01-15T10:30:00Z",
      "expiresAt": "2024-02-15T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 50,
    "limit": 20,
    "offset": 0,
    "hasMore": true
  }
}

Get Opportunity

GET /api/opportunities/{id}

Retrieves the details of an existing opportunity.

Response

{
  "id": "opp_1234567890",
  "title": "Customer Feedback Survey",
  "description": "Help us improve our services",
  "status": "active",
  "tasks": [
    {
      "id": "task_1",
      "title": "Complete Survey",
      "description": "Fill out our feedback form",
      "type": "survey",
      "required": true,
      "order": 1
    }
  ],
  "reward": {
    "type": "voucher",
    "value": 25.00,
    "currency": "USD"
  },
  "createdAt": "2024-01-15T10:30:00Z",
  "expiresAt": "2024-02-15T10:30:00Z"
}

Claims

Claims represent a user's participation in an opportunity.

Create Claim

POST /api/claims

Creates a new claim for an opportunity.

Parameters

ParameterTypeRequiredDescription
opportunityIdstringYesThe ID of the opportunity
userIdstringYesThe ID of the user

Request Body

{
  "opportunityId": "opp_1234567890",
  "userId": "user_1234567890"
}

Response

{
  "id": "claim_1234567890",
  "opportunityId": "opp_1234567890",
  "userId": "user_1234567890",
  "status": "active",
  "progress": {
    "completedTasks": 0,
    "totalTasks": 3,
    "percentage": 0
  },
  "createdAt": "2024-01-15T10:30:00Z"
}

Get Claim

GET /api/claims/{id}

Retrieves the details of an existing claim.

Verifications

Verifications represent proof submissions for task completion.

Create Verification

POST /api/verifications

Submits a verification for a task.

Parameters

ParameterTypeRequiredDescription
taskIdstringYesThe ID of the task
claimIdstringYesThe ID of the claim
textstringNoText description of the verification
assetsarrayNoArray of asset objects (images, videos, etc.)
surveyResponsesarrayNoArray of survey response objects

Request Body

{
  "taskId": "task_1234567890",
  "claimId": "claim_1234567890",
  "text": "I completed the survey as requested",
  "assets": [
    {
      "uri": "https://example.com/screenshot.jpg",
      "mediaType": "image",
      "caption": "Screenshot of completed survey"
    }
  ],
  "surveyResponses": [
    {
      "questionId": "q1",
      "answer": "Very satisfied"
    }
  ]
}

Response

{
  "id": "ver_1234567890",
  "taskId": "task_1234567890",
  "claimId": "claim_1234567890",
  "status": "pending",
  "text": "I completed the survey as requested",
  "assets": [
    {
      "uri": "https://example.com/screenshot.jpg",
      "mediaType": "image",
      "caption": "Screenshot of completed survey"
    }
  ],
  "createdAt": "2024-01-15T10:30:00Z"
}

List Verifications

GET /api/verifications

Returns a list of verifications.

Parameters

ParameterTypeDescription
claimIdstringFilter by claim ID
taskIdstringFilter by task ID
statusstringFilter by status: pending, approved, rejected
limitintegerNumber of verifications to return (1-100, default: 20)
offsetintegerNumber of verifications to skip (default: 0)

Users

User management endpoints.

Get User

GET /api/users/{id}

Retrieves user information.

Response

{
  "id": "user_1234567890",
  "email": "[email protected]",
  "name": "John Doe",
  "profile": {
    "avatar": "https://example.com/avatar.jpg",
    "bio": "User bio"
  },
  "stats": {
    "totalClaims": 5,
    "completedClaims": 3,
    "totalRewards": 75.00
  },
  "createdAt": "2024-01-01T00:00:00Z"
}

Rewards

Reward management endpoints.

List Rewards

GET /api/rewards

Returns a list of rewards for a user.

Parameters

ParameterTypeDescription
userIdstringFilter by user ID
statusstringFilter by status: pending, issued, redeemed
limitintegerNumber of rewards to return (1-100, default: 20)

Response

{
  "data": [
    {
      "id": "reward_1234567890",
      "claimId": "claim_1234567890",
      "userId": "user_1234567890",
      "type": "voucher",
      "value": 25.00,
      "currency": "USD",
      "voucherCode": "REWARD123",
      "status": "issued",
      "expiresAt": "2024-12-31T23:59:59Z",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ]
}

Error Codes

The User-X API uses conventional HTTP response codes to indicate the success or failure of an API request.

CodeDescription
200OK - Everything worked as expected
400Bad Request - The request was unacceptable
401Unauthorized - No valid API key provided
402Request Failed - The parameters were valid but the request failed
403Forbidden - The API key doesn't have permissions
404Not Found - The requested resource doesn't exist
409Conflict - The request conflicts with another request
429Too Many Requests - Too many requests hit the API too quickly
500, 502, 503, 504Server Errors - Something went wrong on our end