Prospect API

Sales Pipeline Management

The Prospect API manages the complete sales pipeline and opportunity workflow for prospects (leads and conversions). It covers prospect workflow creation and management, multi-stage customizable pipelines, automated and manual task handling, custom field definitions and values, lead-to-prospect conversion, meeting tracking, health scoring, and email notifications.

Base URL: https://api.altafid.dev.altafid.net
All requests require standard auth headers — see Authentication and Global Headers.
Key Concepts: A Prospect Workflow represents an opportunity (person or organization) moving through your sales pipeline. Each workflow progresses through customizable Stages, with automatic or manual Tasks assigned to drive progression. Custom Fields extend the data model, and health scoring identifies at-risk or hot opportunities.

Authentication and headers

All endpoints below require standard headers. x-tenant-uuid is mandatory and scopes every request to a single tenant.

HeaderRequiredNotes
Authorization: Bearer <token>requiredAccess token.
x-tenant-uuidrequiredTenant context; checked on every endpoint.
x-staff-uuidoptionalCurrent staff UUID for attribution.
x-rolesoptionalComma-separated roles: SYSTEM_ADMIN, TENANT_ADMIN, TENANT_STAFF.
x-workflow-versionoptionalOptimistic locking version for concurrent updates.
If-MatchoptionalETag for concurrency control.
Idempotency-KeyoptionalUnique key for idempotent request handling.

Workflows

Manage prospect workflows through the sales pipeline. Workflows represent opportunities and progress through customizable stages with automatic task completion, status transitions, and comprehensive tracking.

List and create workflows

EndpointPurpose
GET/api/v1/prospect/workflowsList workflows with advanced filtering (table/kanban view). Supports pagination, sorting, filtering by stage, priority, status, date ranges, currency.
POST/api/v1/prospect/workflowsCreate new workflow. Request: contactUuid, stageUuid, priority, opportunityValue, prospectDueDate, autoAdvance (optional), custom field values.
GET/api/v1/prospect/workflows/{workflowUuid}Get complete workflow detail including stage state, custom fields, tasks, meetings, notes, and history.
PATCH/api/v1/prospect/workflows/{workflowUuid}Update workflow. Can update: priority, opportunityValue, prospectDueDate, stageDueDate, auto-advance setting, and custom field values.
curl "https://api.altafid.dev.altafid.net/api/v1/prospect/workflows?page=0&size=20" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "x-tenant-uuid: YOUR_TENANT_UUID" \
  -H "x-staff-uuid: YOUR_STAFF_UUID"

Workflow transitions and state changes

EndpointPurpose
POST/api/v1/prospect/workflows/{workflowUuid}/transitions/manualManually transition workflow to a specific stage. Request: targetStageUuid, optional notes.
POST/api/v1/prospect/workflows/{workflowUuid}/transitions/dragDrag-drop workflow to a stage (kanban view). Request: targetStageUuid, optional position.
POST/api/v1/prospect/workflows/{workflowUuid}/mark-lostMark workflow as lost/closed. Request: optional reason, notes.
POST/api/v1/prospect/workflows/{workflowUuid}/reactivateReactivate a lost or completed workflow. Request: targetStageUuid.
PATCH/api/v1/prospect/workflows/{workflowUuid}/auto-advanceToggle auto-advance setting. Request: autoAdvance boolean.

Workflow tasks

EndpointPurpose
POST/api/v1/prospect/workflows/{workflowUuid}/manual-tasksCreate manual (adhoc) task. Request: taskType, dueDate, assignedToUuid, description.
GET/api/v1/prospect/workflows/{workflowUuid}/stages/{stageUuid}/tasksGet all tasks for a workflow stage (automated and manual).

Workflow notes and meetings

EndpointPurpose
GET/api/v1/prospect/workflows/{workflowUuid}/stages/{stageUuid}/notesGet notes added during stage execution.
POST/api/v1/prospect/workflows/{workflowUuid}/meetingsLink calendar meeting to workflow. Request: meetingUuid, optional meetingDate, attendees.
GET/api/v1/prospect/workflows/{workflowUuid}/stages/{stageUuid}/meetingsGet meetings linked to stage.
GET/api/v1/prospect/workflows/{workflowUuid}/historyGet complete workflow history timeline (all transitions, task completions, notes).

Settings & Stages

Configure and manage pipeline stages, priorities, notifications, auto-advance behavior, and automated task templates.

Stage management

EndpointPurpose
GET/api/v1/prospect/settings/stagesList all pipeline stages for the tenant with ordering and configuration.
POST/api/v1/prospect/settings/stagesCreate new stage. Request: name, description, optional defaultDueDateDays, color.
PUT/api/v1/prospect/settings/stages/{stageUuid}Update stage (full replacement). Request: name, description, and config fields.
PATCH/api/v1/prospect/settings/stages/{stageUuid}Patch stage (partial update).
DELETE/api/v1/prospect/settings/stages/{stageUuid}Delete stage (cascades if no workflows reference it).
PATCH/api/v1/prospect/settings/stages/orderReorder stages in pipeline. Request: array of {stageUuid, order}.

Path and workflow configuration

EndpointPurpose
GET/api/v1/prospect/settings/path-statusGet path (pipeline) configuration status and activation state.
POST/api/v1/prospect/settings/path/activateActivate path and enroll existing prospects. Request: optional filters for prospect selection.
GET/api/v1/prospect/settings/default-workflow-due-dateGet default due date calculation rules.

Priorities and notifications

EndpointPurpose
GET/api/v1/prospect/settings/prioritiesGet priority disclosures and descriptions.
PUT/api/v1/prospect/settings/prioritiesUpdate priority labels and explanations.
GET/api/v1/prospect/settings/notificationsGet email notification settings (when to notify on stage transitions, overdue tasks, etc.).
PUT/api/v1/prospect/settings/notificationsUpdate notification configuration. Request: flags for stage-change, task-assigned, overdue alerts.

Auto-advance and automated tasks

EndpointPurpose
GET/api/v1/prospect/settings/auto-advanceGet default auto-advance setting for new workflows.
PUT/api/v1/prospect/settings/auto-advanceUpdate default auto-advance behavior. Request: autoAdvanceDefault boolean.
GET/api/v1/prospect/settings/stages/{stageUuid}/automated-tasksList automated task templates for a stage.
POST/api/v1/prospect/settings/stages/{stageUuid}/automated-tasksCreate automated task template. Request: taskType, name, description, dueDateDays.
PUT/api/v1/prospect/settings/stages/{stageUuid}/automated-tasks/{templateUuid}Update task template (full replacement).
DELETE/api/v1/prospect/settings/stages/{stageUuid}/automated-tasks/{templateUuid}Delete task template.

Custom Fields

Define and manage custom fields to extend the prospect workflow data model. Custom fields can be text, numbers, dates, dropdowns, or multi-select with optional validation rules.

Custom field definitions

EndpointPurpose
GET/api/v1/prospect/custom-fieldsList all custom field definitions for the tenant.
POST/api/v1/prospect/custom-fieldsCreate custom field. Request: fieldName, fieldType (TEXT, NUMBER, DATE, DROPDOWN, MULTI_SELECT), required, optional description, defaultValue.
PUT/api/v1/prospect/custom-fields/{definitionUuid}Update custom field definition.
DELETE/api/v1/prospect/custom-fields/{definitionUuid}Delete custom field (cascades if workflows have values).

Custom field values

EndpointPurpose
GET/api/v1/prospect/workflows/{workflowUuid}/custom-fieldsGet all custom field values for a workflow.
PUT/api/v1/prospect/workflows/{workflowUuid}/custom-fieldsUpsert (create or update) custom field values for workflow. Request: map of {fieldDefinitionUuid: value}.

Custom field options (for dropdowns)

EndpointPurpose
GET/api/v1/prospect/custom-fields/{definitionUuid}/optionsList dropdown options for a DROPDOWN-type field.
POST/api/v1/prospect/custom-fields/{definitionUuid}/optionsAdd option to dropdown field. Request: optionLabel, optionValue.

Leads

Manage leads and convert them to prospects. Leads originate from external sources or manual entry and move through a lead-scoring workflow before conversion to prospects.

EndpointPurpose
GET/api/v1/prospect/leadsList leads with pagination and filtering by status, source, date range.
PATCH/api/v1/prospect/leads/{contactUuid}/statusUpdate lead status. Request: status (NEW, QUALIFIED, DISQUALIFIED, CONVERTED).
POST/api/v1/prospect/leads/{contactUuid}/convertConvert single lead to prospect. Request: initialStageUuid, priority, opportunityValue (optional).
POST/api/v1/prospect/leads/bulk-convertBulk convert leads to prospects. Request: array of {contactUuid, initialStageUuid, priority, opportunityValue}.
curl -X POST "https://api.altafid.dev.altafid.net/api/v1/prospect/leads/{contactUuid}/convert" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "x-tenant-uuid: YOUR_TENANT_UUID" \
  -H "Content-Type: application/json" \
  -d '{
    "initialStageUuid": "stage-uuid-123",
    "priority": "HIGH",
    "opportunityValue": 50000
  }'

Contact Pipeline

Access a contact's current workflow and pipeline state. This endpoint provides a single contact's perspective on their prospect status in the pipeline.

EndpointPurpose
GET/api/v1/prospect/contacts/{contactUuid}/pipelineGet contact's current workflow (if active) and pipeline state including current stage, stage duration, tasks, and health indicators.

Data model

WorkflowResponse

Summary of a prospect workflow:

FieldTypeNotes
workflowUuidstringUnique identifier.
contactUuidstringAssociated contact.
currentStageUuidstringCurrent pipeline stage.
stageNamestringCurrent stage name.
prioritystringLOW, MEDIUM, HIGH.
opportunityValuenumberEstimated deal value.
prospectDueDatedatetimeTarget close date.
stageDueDatedatetimeTarget date for current stage.
workflowStatusstringACTIVE, LOST, COMPLETED.
healthScorenumber0-100 health indicator.
autoAdvancebooleanAuto-advance on task completion.
createdAtdatetimeWorkflow creation time.
updatedAtdatetimeLast update time.

WorkflowDetailResponse

Complete workflow details including stage state, tasks, custom fields, meetings, and notes.

StageResponse

Pipeline stage definition:

FieldTypeNotes
stageUuidstringStage identifier.
stageNamestringDisplay name.
descriptionstringStage description.
ordernumberPipeline position (0-based).
defaultDueDateDaysnumberDays to auto-calculate due date.
colorstringHex color for UI display.

CustomFieldDefinition

Schema for a custom field:

FieldTypeNotes
definitionUuidstringField identifier.
fieldNamestringDisplay name.
fieldTypestringTEXT, NUMBER, DATE, DROPDOWN, MULTI_SELECT.
requiredbooleanMandatory field flag.
descriptionstringField help text.
defaultValueanyDefault if not provided.

LeadResponse

Lead object:

FieldTypeNotes
contactUuidstringContact reference.
contactNamestringContact full name.
statusstringNEW, QUALIFIED, DISQUALIFIED, CONVERTED.
sourcestringLead source (WEB_FORM, IMPORT, MANUAL, etc.).
createdAtdatetimeLead creation date.
convertedWorkflowUuidstringWorkflow UUID if converted (nullable).

Pagination Response

Standard pagination envelope for list endpoints:

FieldTypeNotes
contentarrayPage of results.
pagenumberZero-indexed page number.
sizenumberItems per page (default 20).
totalElementsnumberTotal item count.
totalPagesnumberTotal page count.

Status codes and errors

Endpoints return standard HTTP status codes. Success responses are in the 2xx range; client errors in the 4xx range.

Success Codes

200 OK 201 Created 204 No Content

Client Error Codes

400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 409 Conflict 422 Unprocessable Entity

Server Error Codes

500 Internal Server Error 503 Service Unavailable

Error responses include a JSON body with error, message, and timestamp fields for debugging.


Key Features

✓ Multi-stage pipeline ✓ Automated tasks ✓ Auto-advance workflow ✓ Custom fields ✓ Health scoring ✓ Lead conversion ✓ Meeting tracking ✓ Email notifications ✓ Complete audit trail ✓ Concurrency control