apideck.lead
Module apideck.lead
Definitions
ballerinax/apideck.lead Ballerina library
Overview
Apideck is a unified API platform that lets applications integrate with many third-party business systems through one consistent data model. Its Lead API exposes sales leads from the connected CRM systems of your customers, so the same calls work whichever CRM they use.
The Apideck Lead connector gives Ballerina programs typed access to version 10.63.0 of the Apideck Lead API, so you can create, read, update, delete and list leads across the CRM integrations that Apideck Unify supports.
Key features
- Create, update and delete leads in the CRM your customers use
- Read a single lead or list leads with filtering, sorting and cursor-based pagination
- Work across many CRM integrations through one unified lead data model
- Authenticate every request with an API key plus your Unify application and consumer IDs
Setup guide
To use the connector you need an Apideck account, a Unify application and a consumer that has activated a CRM integration.
-
Sign up or log in at the Apideck dashboard.
-
Create a Unify application, or open an existing one.
-
Open the application's API keys page at app.apideck.com/unify/api-keys and copy your secret API key and your application ID.
-
Choose a consumer ID for the user or account whose CRM data you want to reach, and activate a CRM integration for that consumer in Apideck Vault.
Note: Keep the secret API key out of client-side code and version control.
Quickstart
To use the apideck.lead connector in your Ballerina application, update the .bal file as follows:
Step 1: Import the module
import ballerinax/apideck.lead;
Step 2: Instantiate a new connector
Create a Config.toml file with your credentials:
apiKey = "<API key>" appId = "<Application ID>" consumerId = "<Consumer ID>"
Then create the client in your .bal file:
configurable string apiKey = ?; configurable string appId = ?; configurable string consumerId = ?; lead:Client apideck = check new ();
Step 3: Invoke the connector operation
public function main() returns error? { lead:GetLeadsResponse _ = check apideck->listLeads({ authorization: "Bearer " + apiKey, xApideckAppId: appId, xApideckConsumerId: consumerId }); }
Step 4: Run the Ballerina application
bal run
Examples
The Apideck Lead connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- lead_capture_workflow - Capture a new lead, read it back and move it to the Contacted status.
- stale_lead_cleanup - List leads and remove those in a stale status, with a dry-run by default.
Clients
apideck.lead: Client
The Apideck Lead API lets you create, read, update, delete and list leads across CRM integrations through Apideck Unify, using a single unified data model.
Constructor
Gets invoked to initialize the connector.
init (ConnectionConfig config, string serviceUrl)- config ConnectionConfig {} - The configurations to be used when initializing the
connector
- serviceUrl string "https://unify.apideck.com/lead" - URL of the target service
listLeads
function listLeads(ListLeadsHeaders headers, *ListLeadsQueries queries) returns GetLeadsResponse|errorList leads
Parameters
- headers ListLeadsHeaders - Headers to be sent with the request
- queries *ListLeadsQueries - Queries to be sent with the request
Return Type
- GetLeadsResponse|error - Leads
createLead
function createLead(CreateLeadHeaders headers, Lead payload, *CreateLeadQueries queries) returns CreateLeadResponse|errorCreate lead
Parameters
- headers CreateLeadHeaders - Headers to be sent with the request
- payload Lead - Details of the lead to create
- queries *CreateLeadQueries - Queries to be sent with the request
Return Type
- CreateLeadResponse|error - Lead created
getLead
function getLead(string id, GetLeadHeaders headers, *GetLeadQueries queries) returns GetLeadResponse|errorGet lead
Parameters
- id string - ID of the record you are acting upon
- headers GetLeadHeaders - Headers to be sent with the request
- queries *GetLeadQueries - Queries to be sent with the request
Return Type
- GetLeadResponse|error - Lead
deleteLead
function deleteLead(string id, DeleteLeadHeaders headers, *DeleteLeadQueries queries) returns DeleteLeadResponse|errorDelete lead
Parameters
- id string - ID of the record you are acting upon
- headers DeleteLeadHeaders - Headers to be sent with the request
- queries *DeleteLeadQueries - Queries to be sent with the request
Return Type
- DeleteLeadResponse|error - Lead deleted
updateLead
function updateLead(string id, UpdateLeadHeaders headers, Lead payload, *UpdateLeadQueries queries) returns UpdateLeadResponse|errorUpdate lead
Parameters
- id string - ID of the record you are acting upon
- headers UpdateLeadHeaders - Headers to be sent with the request
- payload Lead - Lead fields to update
- queries *UpdateLeadQueries - Queries to be sent with the request
Return Type
- UpdateLeadResponse|error - Lead updated
Records
apideck.lead: Address
Fields
- country? string? - country code according to ISO 3166-1 alpha-2
- notes? string? - Additional notes
- 'string? string? - The address string. Some APIs don't provide structured address data
- city? string? - Name of city
- latitude? string? - Latitude of the address
- county? string? - Address field that holds a sublocality, such as a county
- 'type? "primary"|"secondary"|"home"|"office"|"shipping"|"billing"|"work"|"other"? - The type of address
- id? string? - Unique identifier for the address
- state? string? - Name of state
- line3? string? - Line 3 of the address
- fax? string? - Fax number of the address
- line2? string? - Line 2 of the address
- line1? string? - Line 1 of the address e.g. number, street, suite, apt #, etc
- email? string? - Email address of the address
- longitude? string? - Longitude of the address
- line5? string? - Line 5 of the address
- contactName? string? - Name of the contact person at the address
- website? string? - Website of the address
- line4? string? - Line 4 of the address
- rowVersion? RowVersion? -
- name? string? - The name of the address
- streetNumber? string? - Street number
- phoneNumber? string? - Phone number of the address
- salutation? string? - Salutation of the contact person at the address
- postalCode? string? - Zip code or equivalent
apideck.lead: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 30) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded/x-forwardedheader
- followRedirects? FollowRedirects - Configurations associated with Redirection
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- cookieConfig? CookieConfig - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- socketConfig ClientSocketConfig(default {}) - Provides settings related to client socket configuration
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
- laxDataBinding boolean(default true) - Enables relaxed data binding on the client side. When enabled,
nilvalues are treated as optional, and absent fields are handled asnilabletypes. Enabled by default.
apideck.lead: CreateLeadHeaders
Represents the Headers record for the operation: createLead
Fields
- authorization string - Secret API key sent as a bearer token, for example
Bearer YOUR_API_KEY. Keep it out of client-side code
- xApideckServiceId? string - Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API
- xApideckConsumerId string - ID of the consumer which you want to get or push data from
- xApideckAppId string - The ID of your Unify application
apideck.lead: CreateLeadQueries
Represents the Queries record for the operation: createLead
Fields
- raw boolean(default false) - Include raw response. Mostly used for debugging purposes
apideck.lead: CreateLeadResponse
Fields
- statusCode int - HTTP Response Status Code
- data UnifiedId - A object containing a unique identifier for the resource that was created, updated, or deleted
- 'resource string - Unified API resource name
- raw? Raw? -
- 'service string - Apideck ID of service provider
- operation string - Operation performed
- status string - HTTP Response Status
apideck.lead: CustomMappings
When custom mappings are configured on the resource, the result is included here
apideck.lead: DeleteLeadHeaders
Represents the Headers record for the operation: deleteLead
Fields
- authorization string - Secret API key sent as a bearer token, for example
Bearer YOUR_API_KEY. Keep it out of client-side code
- xApideckServiceId? string - Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API
- xApideckConsumerId string - ID of the consumer which you want to get or push data from
- xApideckAppId string - The ID of your Unify application
apideck.lead: DeleteLeadQueries
Represents the Queries record for the operation: deleteLead
Fields
- raw boolean(default false) - Include raw response. Mostly used for debugging purposes
apideck.lead: DeleteLeadResponse
Fields
- statusCode int - HTTP Response Status Code
- data UnifiedId - A object containing a unique identifier for the resource that was created, updated, or deleted
- 'resource string - Unified API resource name
- raw? Raw? -
- 'service string - Apideck ID of service provider
- operation string - Operation performed
- status string - HTTP Response Status
apideck.lead: Email
Fields
- id? string? - Unique identifier for the email address
- 'type? "primary"|"secondary"|"work"|"personal"|"billing"|"other"? - Email type
- email string? - Email address
apideck.lead: GetLeadHeaders
Represents the Headers record for the operation: getLead
Fields
- authorization string - Secret API key sent as a bearer token, for example
Bearer YOUR_API_KEY. Keep it out of client-side code
- xApideckServiceId? string - Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API
- xApideckConsumerId string - ID of the consumer which you want to get or push data from
- xApideckAppId string - The ID of your Unify application
apideck.lead: GetLeadQueries
Represents the Queries record for the operation: getLead
Fields
- raw boolean(default false) - Include raw response. Mostly used for debugging purposes
- fields? string? - The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. <br /><br />Example:
fields=name,email,addresses.city<br /><br />In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded
apideck.lead: GetLeadResponse
Fields
- statusCode int - HTTP Response Status Code
- data Lead -
- 'resource string - Unified API resource name
- raw? Raw? -
- 'service string - Apideck ID of service provider
- meta? Meta - Response metadata
- operation string - Operation performed
- status string - HTTP Response Status
apideck.lead: GetLeadsResponse
Fields
- statusCode int - HTTP Response Status Code
- data Lead[] -
- 'resource string - Unified API resource name
- raw? Raw? -
- 'service string - Apideck ID of service provider
- meta? Meta - Response metadata
- links? Links - Links to navigate to previous or next pages through the API
- operation string - Operation performed
- status string - HTTP Response Status
apideck.lead: Lead
Fields
- addresses? Address[] -
- ownerId? string? - The owner of the lead
- prefix? string? - The prefix of the lead
- socialLinks? SocialLink[] -
- leadSource? string? - The source of the lead
- description? string? - The description of the lead
- createdAt? string? - Date created in ISO 8601 format
- language? string? - language code according to ISO 639-1. For the United States - EN
- monetaryAmount? decimal? - The monetary amount of the lead
- contactId? string? - The contact the lead is associated with
- title? string? - The job title of the lead
- customMappings? CustomMappings? -
- emails? Email[] -
- updatedAt? string? - Date updated in ISO 8601 format
- id? string - Unique identifier for the contact
- fax? string? - The fax number of the lead
- firstName? string? - The first name of the lead
- leadId? string? - The identifier of the lead
- ownerName? string? - The name of the owner of the lead
- companyId? string? - The company the lead is associated with
- customFields? CustomField[]? -
- passThrough? PassThroughBody -
- lastName? string? - The last name of the lead
- tags? Tags? -
- phoneNumbers? PhoneNumber[] -
- companyName? string? - The name of the company the lead is associated with
- name? string - Full name of the lead
- websites? Website[] -
- status? string? -
apideck.lead: LeadsFilter
Fields
- name? string - Name of the lead to filter on
- lastName? string - Last name of the lead to filter on
- phoneNumber? string - Phone number of the lead to filter on
- firstName? string - First name of the lead to filter on
- email? string - E-mail of the lead to filter on
apideck.lead: LeadsSort
Fields
- 'by? "created_at"|"updated_at"|"name"|"first_name"|"last_name"|"email" - The field on which to sort the Leads
- direction? SortDirection - The direction in which to sort the results
apideck.lead: Links
Links to navigate to previous or next pages through the API
Fields
- next? string? - Link to navigate to the previous page through the API
- current? string - Link to navigate to the current page through the API
- previous? string? - Link to navigate to the previous page through the API
apideck.lead: ListLeadsHeaders
Represents the Headers record for the operation: listLeads
Fields
- authorization string - Secret API key sent as a bearer token, for example
Bearer YOUR_API_KEY. Keep it out of client-side code
- xApideckServiceId? string - Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API
- xApideckConsumerId string - ID of the consumer which you want to get or push data from
- xApideckAppId string - The ID of your Unify application
apideck.lead: ListLeadsQueries
Represents the Queries record for the operation: listLeads
Fields
- cursor? string? - Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response
- filter? LeadsFilter - Apply filters
- 'limit int(default 20) - Number of results to return. Minimum 1, Maximum 200, Default 20
- raw boolean(default false) - Include raw response. Mostly used for debugging purposes
- sort? LeadsSort - Apply sorting
- fields? string? - The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. <br /><br />Example:
fields=name,email,addresses.city<br /><br />In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded
apideck.lead: Meta
Response metadata
Fields
- itemsOnPage? int - Number of items returned in the data property of the response
- cursors? MetaCursors - Cursors to navigate to previous or next pages through the API
- totalCount? int - Number of records available in total for this resource
- warnings? MetaWarnings[]? - Non-fatal warnings emitted when optional workflow steps failed. Present only when at least one step degraded; the response status remains 200
apideck.lead: MetaCursors
Cursors to navigate to previous or next pages through the API
Fields
- next? string? - Cursor to navigate to the next page of results through the API
- current? string? - Cursor to navigate to the current page of results through the API
- previous? string? - Cursor to navigate to the previous page of results through the API
apideck.lead: MetaWarnings
Advisory warning emitted when an optional workflow step fails non-fatally. The overall request still succeeds (HTTP 200); inspect this to detect partial or degraded data
Fields
- statusCode? int? - HTTP status code returned by the failed downstream request, when available
- 'type? string - Discriminator for the warning kind
- 'error? string? - Short error description from the downstream provider, when available
- message? string? - Detailed message from the downstream provider, when available
- operation? string? - Identifier of the workflow step that failed
apideck.lead: PassThroughItem
Fields
- serviceId string - Identifier for the service to which this pass_through should be applied
- operationId? string - Optional identifier for a workflow operation to which this pass_through should be applied. This is useful for Unify calls that are making more than one downstream request
- extendObject? record {} - Simple object allowing any properties for direct extension
- extendPaths? PassThroughItem_extend_paths[] - Array of objects for structured data modifications via paths
apideck.lead: PassThroughItem_extend_paths
Fields
- path string - JSONPath string specifying where to apply the value.
- value anydata - The value to set at the specified path, can be any type.
apideck.lead: PhoneNumber
Fields
- countryCode? string? - The country code of the phone number, e.g. +1
- number string - The phone number
- extension? string? - The extension of the phone number
- areaCode? string? - The area code of the phone number, e.g. 323
- id? string? - Unique identifier of the phone number
- 'type? "primary"|"secondary"|"home"|"work"|"office"|"mobile"|"assistant"|"fax"|"direct-dial-in"|"personal"|"billing"|"other"? - The type of phone number
apideck.lead: Raw
Raw response from the integration when raw=true query param is provided
apideck.lead: SocialLink
Fields
- id? string? - Unique identifier of the social link
- 'type? string? - Type of the social link, e.g. twitter
- url string - URL of the social link, e.g. https://www.twitter.com/apideck
apideck.lead: UnifiedId
A object containing a unique identifier for the resource that was created, updated, or deleted
Fields
- id string - The unique identifier of the resource
apideck.lead: UpdateLeadHeaders
Represents the Headers record for the operation: updateLead
Fields
- authorization string - Secret API key sent as a bearer token, for example
Bearer YOUR_API_KEY. Keep it out of client-side code
- xApideckServiceId? string - Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API
- xApideckConsumerId string - ID of the consumer which you want to get or push data from
- xApideckAppId string - The ID of your Unify application
apideck.lead: UpdateLeadQueries
Represents the Queries record for the operation: updateLead
Fields
- raw boolean(default false) - Include raw response. Mostly used for debugging purposes
apideck.lead: UpdateLeadResponse
Fields
- statusCode int - HTTP Response Status Code
- data UnifiedId - A object containing a unique identifier for the resource that was created, updated, or deleted
- 'resource string - Unified API resource name
- raw? Raw? -
- 'service string - Apideck ID of service provider
- operation string - Operation performed
- status string - HTTP Response Status
apideck.lead: Website
Fields
- id? string? - Unique identifier for the website
- 'type? "primary"|"secondary"|"work"|"personal"|"other"? - The type of website
- url string - The website URL
Union types
apideck.lead: SortDirection
SortDirection
The direction in which to sort the results
apideck.lead: Currency
Currency
Indicates the associated currency for an amount of money. Values correspond to ISO 4217
Array types
apideck.lead: PassThroughBody
PassThroughBody
The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources
apideck.lead: Tags
Tags
Anydata types
apideck.lead: CustomField
CustomField
String types
apideck.lead: RowVersion
RowVersion
A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object
Import
import ballerinax/apideck.lead;Metadata
Released date: 1 day ago
Version: 2.0.0
License: Apache-2.0
Security
Direct vulnerabilities: No known direct vulnerabilities
Indirect vulnerabilities:
Checked on 2026-11-21 via OSV.dev
Compatibility
Platform: any
Ballerina version: 2201.12.0
GraalVM compatible: Yes
Pull count
Total: 44
Current verison: 1
Weekly downloads
Keywords
Vendor/Apideck
Area/CRM & Sales
Type/Connector
Contributors