curl -X POST "https://app.lance.so/api/v1/operations/crm/test-connection" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"provider": "close",
"apiKey": "api_xxxxxxxxxxxxxxxxxxxxxxxx"
}'
const response = await fetch("/api/v1/operations/crm/test-connection", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
provider: "close",
apiKey: "api_xxxxxxxxxxxxxxxxxxxxxxxx",
}),
});
const data = await response.json();
interface TestConnectionRequest {
provider: "close" | "bullhorn";
apiKey: string;
}
interface TestConnectionResponse {
success: boolean;
error?: string;
}
const request: TestConnectionRequest = {
provider: "close",
apiKey: "api_xxxxxxxxxxxxxxxxxxxxxxxx",
};
const response = await fetch("/api/v1/operations/crm/test-connection", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});
const data: TestConnectionResponse = await response.json();
{
"success": true
}
{
"success": false,
"error": "Invalid API key"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid enum value. Expected 'close' | 'bullhorn', received 'invalid'"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "API key is required"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Organization ID required"
}
}
CRM Integration
Test CRM Connection
Test the connection to a CRM provider using provided credentials
POST
/
api
/
v1
/
operations
/
crm
/
test-connection
curl -X POST "https://app.lance.so/api/v1/operations/crm/test-connection" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"provider": "close",
"apiKey": "api_xxxxxxxxxxxxxxxxxxxxxxxx"
}'
const response = await fetch("/api/v1/operations/crm/test-connection", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
provider: "close",
apiKey: "api_xxxxxxxxxxxxxxxxxxxxxxxx",
}),
});
const data = await response.json();
interface TestConnectionRequest {
provider: "close" | "bullhorn";
apiKey: string;
}
interface TestConnectionResponse {
success: boolean;
error?: string;
}
const request: TestConnectionRequest = {
provider: "close",
apiKey: "api_xxxxxxxxxxxxxxxxxxxxxxxx",
};
const response = await fetch("/api/v1/operations/crm/test-connection", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});
const data: TestConnectionResponse = await response.json();
{
"success": true
}
{
"success": false,
"error": "Invalid API key"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid enum value. Expected 'close' | 'bullhorn', received 'invalid'"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "API key is required"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Organization ID required"
}
}
This endpoint tests the connection to a CRM provider (Close or Bullhorn) using the provided API key. Use this to validate credentials before saving CRM settings or to verify that existing credentials are still working.
Authentication
This endpoint requires authentication. The request must include a valid
session with an associated organization.
Request
Body Parameters
string
required
The CRM provider to connect to. Allowed values:
close, bullhornstring
required
The API key for authenticating with the CRM provider. Must be at least 1
character. - For Close: Use your Close API key from Settings > API Keys -
For Bullhorn: Use your Bullhorn REST API credentials
Response
boolean
required
Indicates whether the connection test was successful. -
true: The API key is
valid and connection was established - false: The connection failed (see
error field for details)string
Error message describing why the connection test failed. Only present when
success is false. Common errors include: - Invalid API key - Network
connectivity issues - CRM service unavailablecurl -X POST "https://app.lance.so/api/v1/operations/crm/test-connection" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"provider": "close",
"apiKey": "api_xxxxxxxxxxxxxxxxxxxxxxxx"
}'
const response = await fetch("/api/v1/operations/crm/test-connection", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
provider: "close",
apiKey: "api_xxxxxxxxxxxxxxxxxxxxxxxx",
}),
});
const data = await response.json();
interface TestConnectionRequest {
provider: "close" | "bullhorn";
apiKey: string;
}
interface TestConnectionResponse {
success: boolean;
error?: string;
}
const request: TestConnectionRequest = {
provider: "close",
apiKey: "api_xxxxxxxxxxxxxxxxxxxxxxxx",
};
const response = await fetch("/api/v1/operations/crm/test-connection", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});
const data: TestConnectionResponse = await response.json();
{
"success": true
}
{
"success": false,
"error": "Invalid API key"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid enum value. Expected 'close' | 'bullhorn', received 'invalid'"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "API key is required"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Organization ID required"
}
}
Error Codes
| Status Code | Error Code | Description |
|---|---|---|
400 | VALIDATION_ERROR | Missing or invalid request parameters (provider or apiKey) |
401 | VALIDATION_ERROR | User is not authenticated or not associated with an organization |
500 | INTERNAL_ERROR | Server error during connection test |
Supported CRM Providers
Close CRM
- Provider value:
close - API Key format: Starts with
api_followed by alphanumeric characters - Documentation: Close API Documentation
Bullhorn CRM
- Provider value:
bullhorn - API Key format: REST API credentials from Bullhorn
- Documentation: Bullhorn REST API
Notes
- This endpoint only tests the connection; it does not save credentials
- To save CRM settings after a successful test, use the CRM settings endpoint
- The connection test verifies API key validity by making a lightweight request to the CRM provider
- Rate limiting may apply based on your CRM provider’s API limits