How it works
The Leonar API is a standard REST API with an OpenAPI 3.0 spec. AI agent frameworks consume this spec to generate tool definitions automatically.openapi.yaml is the single source of truth for REST-based agents. If your client supports MCP, you can also connect directly to Leonar’s native MCP server.
Setup
1. Create a scoped API key
Go to Settings > API and create a key with only the scopes your agent needs.2. Load the OpenAPI spec
3. Set the base URL and auth header
Rate limiting strategy
The API allows 2000 requests per hour. For autonomous agents:- Check headers: Every response includes
X-RateLimit-RemainingandX-RateLimit-Reset - Batch operations: Use bulk endpoints (e.g., enroll up to 500 contacts at once) instead of individual calls
- Exponential backoff: On
429responses, wait2^attemptseconds before retrying - Pagination: Default
limit=50. Useoffsetto paginate. Don’t fetch all pages unless needed.
Common agent workflows
Workflow 1: Source and add candidates to a project
Workflow 2: Enrich and enroll in sequence
Workflow 3: Deal pipeline management
Error handling for agents
Your agent should handle these error patterns:Best practices for autonomous agents
Start with read-only
Let the agent explore data before writing. Most mistakes come from creating or updating with wrong data.
Confirm before bulk actions
Enrolling 500 contacts in a sequence is hard to undo. Have the agent confirm with the user before bulk writes.
Use source-specific endpoints
Use
/sourcing/linkedin/search instead of the generic /sourcing/search. The flat schemas are easier for agents to construct.Check existing data first
Before creating a contact, search by email or LinkedIn URL to avoid duplicates.
Testing your agent
- Create a test API key with
read_onlyscopes only - Run your agent on a read-only task (e.g., “list all active projects and their candidate counts”)
- Verify outputs — check that the agent correctly interprets the API responses
- Upgrade scopes once read-only works, add write scopes one at a time
- Test write operations on a test project before going live