Pool Tournament REST API Documentation

This document provides comprehensive information about the Pool Tournament REST API endpoints for updating scores and searching matchups using metadata matching.

Table of Contents


Overview

These endpoints provide flexible ways to interact with pool tournaments by leveraging a metadata matching system. Instead of requiring exact IDs, you can use metadata to identify matchups and users, making it easier to integrate with external systems.

💡 Learn about setting Lucra user metadata herearrow-up-right

Authentication: All endpoints require an API key passed via the X-Lucra-Api-Key header (not as a query parameter).

Both endpoints support:

  • Direct ID lookup (fastest)

  • Metadata-based fuzzy matching (flexible)

  • Game and location filtering


Quick Start with cURL

Ready-to-use cURL examples for the sandbox environment. Simply replace YOUR_API_KEY_HERE with your actual API key.

Update User Score

Search for Matchups

Using Direct IDs (Fastest)

Using Game ID and Location


Metadata Matching System

The metadata matching system scores records based on how well their metadata matches your search criteria.

Important: Only records with a similarity score greater or equal than 1.0 are returned. This means at least one field must have an exact match, or multiple fields must have partial matches that sum to more than 1.0.

How Matching Works

The system evaluates matches using a scoring algorithm with the following rules:

1. Reserved Field: externalId (Highest Priority)

If your search metadata includes the externalId field, it takes absolute precedence over all other fields:

Behavior:

  • When externalId is present in the search, only exact matches are returned (score: 1)

  • If externalId doesn't match exactly, the record is excluded (score: 0)

  • No other fields are evaluated when externalId is present

Use Case: This is ideal when you're syncing data from external systems and need deterministic, exact matching.

2. Regular Field Matching

When externalId is not present, the system scores based on field similarity:

Match Type
Weight
Description

Exact Match

1.0

Field values are identical

Partial String Match

0.5

Search string is contained within record string (case-insensitive)

Array Intersection

0.7

Proportional to overlapping elements (e.g., 2 of 3 = 0.47)

Nested Object

0.8 × nested_score

Recursive matching with reduced weight

3. Supported Data Types

  • Strings: Case-insensitive partial matching

  • Numbers: Exact value comparison

  • Arrays: Intersection-based scoring

  • Objects: Recursive metadata matching

  • Booleans: Exact match only

4. Examples

Example 1: Reserved Field Match (externalId)

Example 2: String Match

Example 3: Array Intersection

Example 4: Combined Matching

Example 5: Below Minimum Threshold (Not Returned)


Endpoints

Update User Scores with Matching

Updates scores for users in tournaments by matching both the matchup and user using metadata.

Endpoint: POST /pool-tournament/user-score

Authentication: Pass API key via X-Lucra-Api-Key header

⚠️ Important Behavior:

  • Scores will be applied to ALL matchups that match your criteria AND where the identified user is a participant

  • If your criteria match 5 tournaments and the user is participating in all 5, their score will be updated in all 5 tournaments

  • Use specific criteria (like externalId or direct matchupId) if you intend to update only a single matchup

Request Headers

Request Payload

Field Descriptions

Matchup Identifiers (at least one required):

  • matchupId: Directly specify the matchup UUID (fastest, most precise)

  • matchupMetadata: JSON object to match against matchup metadata using similarity scoring

  • gameId: Filter matchups by game identifier

  • locationId: Filter matchups by location UUID

User Identifiers (one required):

  • userId: Directly specify the user UUID (fastest, most precise)

  • phoneNumber: User's phone number (exact match required)

  • userMetadata: JSON object to match against user metadata using similarity scoring

Score Information:

  • score: (required) Numeric score value

  • metadata: (optional) Additional JSON metadata about this score

  • attemptFinished: (optional) Boolean indicating if the attempt is complete

Matching Priority

The system searches for matchups using combined criteria:

  1. matchupId (if provided) - Returns immediately

  2. matchupMetadata + gameId + locationId (if all/either provided) - Searches using similarity scoring and combined criteria

For users:

  1. userId (if provided) - Returns immediately

  2. phoneNumber (if provided) - Exact match lookup

  3. userMetadata (if provided) - Searches using similarity scoring

Response

Success Response (200):

Response Fields:

  • status: Always "success" for successful requests

  • data.affectedMatchupIds: Array of matchup UUIDs where scores were successfully updated

  • data.failedMatchupIds: Array of matchup UUIDs where score updates failed

Example Success Response (Multiple Matchups Updated):

Example Partial Failure Response:

Example Error Response (Matchup Not Found):

Example Error Response (Missing Identifiers):

Example Error Response (User Not Found):

Example Requests

Example 1: Update by Direct IDs

Example 2: Update by Metadata (Single Matchup)

Example 3: Update by Phone Number

Example 4: Update Multiple Matchups by Game and Location

Example 5: Complex Metadata Matching

Processing Flow

  1. Validation: Request is validated against schema

  2. API Key Verification: Tenant is identified from X-Lucra-Api-Key header

  3. Matchup Matching: System finds all matchups matching your criteria (score >= 1.0) using combined filters

  4. User Matching: System identifies the user from userId, phoneNumber, or userMetadata (score >= 1.0)

  5. Participation Filter: System filters matchups to only those where the user is a participant

  6. Score Updates: Scores are updated for ALL filtered matchups in parallel

  7. Logging: All ingestion attempts are logged for auditing and debugging

  8. Response: Returns lists of successful and failed matchup IDs

Example: If you search by gameId: "rocket-league" and there are 10 active Rocket League tournaments where user "player-123" is participating, the score will be updated in all 10 tournaments.


Search User Matchups by Metadata

Searches for matchups that a user is participating in, using flexible metadata matching.

Endpoint: POST /pool-tournament/query

Authentication: Pass API key via X-Lucra-Api-Key header

Note: Only returns matchups with a metadata similarity score greater or equal than 1.0. If user identifiers are provided, only matchups where the user is a participant are returned.

Request Headers

Request Payload

Field Descriptions

Matchup Identifiers (at least one required):

  • matchupId: Directly specify the matchup UUID

  • matchupMetadata: JSON object to match against matchup metadata

  • gameId: Filter matchups by game identifier

  • locationId: Filter matchups by location UUID

User Identifiers (optional):

  • userId: Filter for specific user UUID

  • phoneNumber: User's phone number (exact match required)

  • userMetadata: Match user by metadata

Note: If no user identifier (userId, phoneNumber, or userMetadata) is provided, the endpoint returns ALL matching matchups regardless of participants.

Response

Success Response (200):

Response Fields:

  • status: Always "success" for successful requests

  • data: Array of matchup UUIDs that match the search criteria

Example Success Response (Multiple Matchups Found):

Example Success Response (No Matchups Found):

Example Error Response (User Not Found):

Example Error Response (Missing Identifiers):

Example Error Response (Matchup Not Found):

Example Requests

Example 1: Find User's Matchups by Direct IDs

Example 2: Find Matchups by Metadata (No User Filter)

Example 3: Find User's Matchups by Metadata

Example 4: Find Matchups by Phone Number

Example 5: Complex Search with Multiple Filters

Processing Flow

  1. Validation: Request is validated against schema

  2. API Key Verification: Tenant is identified from X-Lucra-Api-Key header

  3. Matchup Search: System finds matchups matching provided identifiers (score >= 1.0 for metadata matching) using combined filters

  4. User Search (if provided): System identifies user from userId, phoneNumber, or userMetadata (score >= 1.0 for metadata matching)

  5. Participation Filter (if user provided): Filters matchups to only those where the user is a participant

  6. Response: Returns array of matching matchup UUIDs

Search Priority:

  • Matchups: matchupId → matchupMetadata + gameId + locationId (combined)

  • Users: userId → phoneNumber → userMetadata


Error Handling

Error Response Format

All errors follow this consistent format:

Common Errors

Error Message
Scenario
Resolution

"No matchup identifiers were provided"

No matchup identifier provided

Provide at least one of: matchupId, matchupMetadata, gameId, or locationId

"Matchup not found"

No matchups matched search criteria

Check your metadata values

"User not found"

No user matched search criteria

Verify user exists and identifiers are correct

"Invalid Api Key."

API key is invalid or expired

Check your API key configuration and header format

Validation errors (various)

Request payload validation failed

Check request structure matches schema (see examples below)

Example Error Responses

Missing Matchup Identifiers:

Matchup Not Found:

User Not Found:

Invalid API Key:

Validation Error Examples:

Handling Score Update Failures

When updating scores across multiple matchups, partial failures are possible. The response will still have status: "success" but will include failed matchup IDs:

How to handle:

  • Check data.failedMatchupIds to identify which updates failed

  • Failed updates are logged with error details for debugging

  • You can retry failed updates individually using their specific matchup IDs


Best Practices

1. Use externalId for Deterministic Matching

When you need exact matches, use the externalId field in metadata:

This ensures only exact matches are returned, preventing unintended updates to similar matchups.

2. Prefer Direct IDs When Available

Direct IDs are faster and more precise:

3. Use Phone Number for Simple User Lookup

When you have the user's phone number, it's a straightforward way to identify them:

4. Combine Identifiers for Precision

Layer multiple identifiers to narrow results:

Note: All provided criteria are evaluated together.

5. Structure Metadata Consistently

Maintain consistent metadata structure across your system:

6. Use Descriptive Metadata Keys

Choose metadata keys that are descriptive and unlikely to collide:

7. Test Metadata Matching First

Before updating scores, test your search criteria using the search endpoint:

8. Understand Multiple Match Behavior

Critical: Metadata matching can return multiple results, and this behavior is different for updates vs. searches:

  • For Updates: Scores will be updated across ALL matchups where:

    • The matchup matches your criteria (score >= 1.0)

    • AND the user is a participant in that matchup

  • For Search: You'll receive ALL matchup IDs that match your criteria (score >= 1.0)

Example Scenario:

To update only ONE matchup:

  • Use direct matchupId (most precise)

  • Use externalId in matchupMetadata (deterministic)

  • Combine multiple filters to narrow results (e.g., gameId + locationId + metadata)

9. Monitor Score Updates

All score update attempts are logged for auditing and debugging purposes. Contact your integration support team if you need to review historical update attempts or troubleshoot failed updates.

10. Rate Limiting and Performance

  • Use direct IDs for high-frequency operations

  • Metadata matching is more resource-intensive than ID lookups

  • Consider caching frequently accessed matchup/user IDs


Support

For issues or questions:

  1. Check error messages and logs

  2. Review this documentation

  3. Verify your metadata structure

  4. Verify API key is passed in the X-Lucra-Api-Key header

  5. Test with the search endpoint first

  6. Contact your integration support team


Last Updated: 2025-11-19 Version: 1.1

Last updated