Skip to main content
The bounties router provides comprehensive endpoints for creating, managing, and interacting with bounties. This includes bounty creation with Stripe payment integration, voting, bookmarking, commenting, and submission workflows.

Queries

getBountyStats

Get global bounty statistics including total bounties, active bounties, and total payout. Access: Public Response:
{
  success: boolean;
  data: {
    totalBounties: number;
    activeBounties: number;
    totalBountiesValue: number;
    totalPayout: number;
  };
}

getMonthlySpend

Get monthly spending stats for the active organization. Access: Organization members only Response:
{
  success: boolean;
  data: {
    monthlySpend: number;
    bountyCount: number;
    allTimeSpend: number;
    allTimeBountyCount: number;
    periodStart: string;
    periodEnd: string;
    nextResetDate: string;
  };
}

fetchAllBounties

Fetch all bounties with pagination, filtering, and search capabilities. Access: Protected (authenticated users)
page
number
default:"1"
Page number for pagination
limit
number
default:"20"
Number of results per page (max 100)
status
string
Filter by status: draft, open, in_progress, completed, or cancelled
Search bounties by title or description
tags
string[]
Filter by tags
creatorId
string
Filter by creator user ID
sortBy
string
default:"created_at"
Sort field: created_at, amount, deadline, or title
sortOrder
string
default:"desc"
Sort order: asc or desc
Example:
const bounties = await trpc.bounties.fetchAllBounties.query({
  page: 1,
  limit: 20,
  status: 'open',
  sortBy: 'amount',
  sortOrder: 'desc'
});

fetchBountyById

Get detailed information about a specific bounty. Access: Protected
id
string
required
UUID of the bounty

getBountyDetail

Get comprehensive bounty details including votes, bookmarks, and comments. Access: Public
id
string
required
UUID of the bounty
Response includes:
  • Bounty details with creator information
  • Vote count and user’s vote status
  • Bookmark status for authenticated users
  • All comments with like counts
  • GitHub integration details (if linked)

randomBounty

Get a random open bounty. Access: Public

getBountiesByUserId

Get all bounties created by a specific user. Access: Public
userId
string
required
User ID to fetch bounties for

getHighlights

Get featured/pinned bounties for a user. Access: Public
userId
string
required
User ID to fetch highlights for

getBountyVotes

Get vote count and user’s vote status for a bounty. Access: Public
bountyId
string
required
UUID of the bounty

getBountyBookmark

Check if the current user has bookmarked a bounty. Access: Public
bountyId
string
required
UUID of the bounty

getBountyStatsMany

Get statistics (comments, votes, submissions, bookmarks) for multiple bounties. Access: Public
bountyIds
string[]
required
Array of bounty UUIDs (max 100)

listBookmarkedBounties

List all bounties bookmarked by the current user. Access: Protected
page
number
default:"1"
Page number
limit
number
default:"20"
Results per page (max 100)

getBountyComments

Get all comments for a bounty with like counts. Access: Public
bountyId
string
required
UUID of the bounty

fetchMyBounties

Get all bounties for the active organization. Access: Organization members only
page
number
default:"1"
Page number
limit
number
default:"20"
Results per page (max 100)
status
string
Filter by status

getBountyPaymentStatus

Get payment status and fee information for a bounty. Access: Protected (organization members only)
bountyId
string
required
UUID of the bounty

getBountySubmissions

Get all submissions for a bounty. Access: Public
bountyId
string
required
UUID of the bounty

Mutations

createBounty

Create a new bounty with optional payment integration. Access: Organization members only (rate limited)
title
string
required
Bounty title (1-200 characters)
description
string
required
Detailed description (minimum 10 characters)
amount
string
required
Bounty amount (must match regex: /^\d{1,13}(\.\d{1,2})?$/)
currency
string
default:"USD"
Currency code
deadline
string
ISO 8601 datetime string (must be today or future)
tags
string[]
Array of tag strings
repositoryUrl
string
Git repository URL
issueUrl
string
GitHub issue URL
payLater
boolean
default:"false"
Create bounty without immediate payment
githubInstallationId
number
GitHub App installation ID
githubIssueNumber
number
GitHub issue number
linearIssueId
string
Linear issue ID for integration
Example:
const result = await trpc.bounties.createBounty.mutate({
  title: "Fix login bug",
  description: "Users cannot login with Google OAuth",
  amount: "500.00",
  currency: "USD",
  tags: ["bug", "auth"],
  issueUrl: "https://github.com/org/repo/issues/42",
  payLater: false
});

if (result.checkoutUrl) {
  // Redirect user to Stripe checkout
  window.location.href = result.checkoutUrl;
}

updateBounty

Update an existing bounty. Access: Organization members only
id
string
required
UUID of the bounty
title
string
Updated title (1-200 characters)
description
string
Updated description (minimum 10 characters)
deadline
string
Updated deadline (must be today or future)
tags
string[]
Updated tags
status
string
Updated status: draft, open, in_progress, completed, or cancelled
Bounty amount and currency cannot be changed after creation.

deleteBounty

Delete a bounty (only if unfunded and has no submissions). Access: Organization members only
id
string
required
UUID of the bounty

toggleBountyPin

Pin or unpin a bounty as featured. Access: Organization members only
bountyId
string
required
UUID of the bounty

voteBounty

Toggle vote on a bounty. Access: Protected
bountyId
string
required
UUID of the bounty

toggleBountyBookmark

Toggle bookmark on a bounty. Access: Protected
bountyId
string
required
UUID of the bounty

addBountyComment

Add a comment to a bounty. Access: Protected (rate limited)
bountyId
string
required
UUID of the bounty
content
string
required
Comment text (1-245 characters)
parentId
string
UUID of parent comment for replies

updateBountyComment

Edit a comment (limited to 1 edit per comment). Access: Protected (own comments only)
commentId
string
required
UUID of the comment
content
string
required
Updated comment text (1-245 characters)

deleteBountyComment

Delete a comment. Access: Protected (own comments only)
commentId
string
required
UUID of the comment

toggleCommentLike

Toggle like on a comment. Access: Protected
commentId
string
required
UUID of the comment

applyToBounty

Submit an application to work on a bounty. Access: Protected
bountyId
string
required
UUID of the bounty
message
string
required
Application message (minimum 10 characters)

submitBountyWork

Submit completed work for a bounty. Access: Protected (assigned user only)
bountyId
string
required
UUID of the bounty
description
string
required
Submission description (minimum 10 characters)
deliverableUrl
string
required
URL to the deliverable
pullRequestUrl
string
GitHub pull request URL

confirmBountyPayment

Confirm payment and make bounty live. Access: Protected (organization members only)
bountyId
string
required
UUID of the bounty

approveBountySubmission

Approve a submission and release payment to solver. Access: Protected (organization members only)
bountyId
string
required
UUID of the bounty
submissionId
string
required
UUID of the submission to approve
The solver must have a connected Stripe account to receive payment.

verifyCheckoutPayment

Verify payment after Stripe checkout completion. Access: Protected (rate limited)
sessionId
string
required
Stripe checkout session ID

recheckPaymentStatus

Manually recheck payment status from Stripe. Access: Protected (rate limited)
bountyId
string
required
UUID of the bounty

createPaymentForBounty

Create a Stripe checkout session for an unfunded bounty. Access: Protected (organization members only)
bountyId
string
required
UUID of the bounty
origin
string
Base URL for redirect URLs

requestCancellation

Request cancellation and refund for a funded bounty. Access: Protected (organization members only)
bountyId
string
required
UUID of the bounty
reason
string
Reason for cancellation
Cancellation requests are reviewed by the support team. Bounties with approved submissions cannot be cancelled.

cancelCancellationRequest

Withdraw a pending cancellation request. Access: Protected (organization members only)
bountyId
string
required
UUID of the bounty

Code Examples

Creating a Bounty with Payment

import { trpc } from '@/lib/trpc';

const createBountyWithPayment = async () => {
  try {
    const result = await trpc.bounties.createBounty.mutate({
      title: "Implement dark mode",
      description: "Add dark mode support to the application with theme toggle",
      amount: "250.00",
      currency: "USD",
      tags: ["frontend", "ui"],
      deadline: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
      repositoryUrl: "https://github.com/myorg/myrepo",
      payLater: false
    });

    if (result.checkoutUrl) {
      // Redirect to Stripe checkout
      window.location.href = result.checkoutUrl;
    }
  } catch (error) {
    console.error('Failed to create bounty:', error);
  }
};

Fetching and Displaying Bounties

import { trpc } from '@/lib/trpc';

const BountiesList = () => {
  const { data, isLoading } = trpc.bounties.fetchAllBounties.useQuery({
    page: 1,
    limit: 10,
    status: 'open',
    sortBy: 'created_at',
    sortOrder: 'desc'
  });

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      {data?.data.map(bounty => (
        <div key={bounty.id}>
          <h3>{bounty.title}</h3>
          <p>{bounty.description}</p>
          <span>${bounty.amount} {bounty.currency}</span>
        </div>
      ))}
    </div>
  );
};

Approving a Submission

import { trpc } from '@/lib/trpc';

const approveSubmission = async (bountyId: string, submissionId: string) => {
  try {
    const result = await trpc.bounties.approveBountySubmission.mutate({
      bountyId,
      submissionId
    });

    console.log(result.message); // "Submission approved and payment released"
  } catch (error) {
    if (error.message.includes('Stripe account')) {
      alert('The solver needs to connect their Stripe account first');
    }
  }
};

Build docs developers (and LLMs) love