purchase_service
Purchase fixed-price services on the402.ai marketplace. Creates async jobs with payment from pre-funded balance, returning immediate results for data services or provider-fulfilled work for automated/human services.
Instructions
Purchase a fixed-price service on the402.ai. Creates an async job and conversation thread. Payment is deducted from your pre-funded balance. For data_api services, results are returned immediately. For automated/human services, the provider fulfills the work asynchronously. Requires API key.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service_id | Yes | The service ID to purchase | |
| brief | Yes | Description of what you need — must include all required fields defined in the service's input_schema |
Implementation Reference
- src/tools/purchases.ts:6-28 (handler)The registration and implementation handler for the 'purchase_service' tool.
server.tool( "purchase_service", "Purchase a fixed-price service on the402.ai. Creates an async job and conversation thread. Payment is deducted from your pre-funded balance. For data_api services, results are returned immediately. For automated/human services, the provider fulfills the work asynchronously. Requires API key.", { service_id: z.string().describe("The service ID to purchase"), brief: z .string() .describe( "Description of what you need — must include all required fields defined in the service's input_schema" ), }, async ({ service_id, brief }) => { const result = await client.balancePost( `/v1/services/${service_id}/purchase`, { brief } ); return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2) }, ], }; } );