Skip to content

ApiCall__c

Sobject

apex
global class ApiCall__c extends SObject

Extends: SObject

Tracks API calls (inbound and outbound) through their full lifecycle. Each record represents a single API call with its request, response, status, and performance metrics.


Fields

FieldDescription
global List ApiIssues__rReciprocal relationship for ApiIssue__c.ApiCall__c.
global Decimal CalloutDurationMs__cTime taken for the actual HTTP callout to the external service, in milliseconds.
global Decimal CommitDurationMs__cTime taken to commit (DML) records produced by the API handler, in milliseconds.
global Boolean DeadLettered__cFormula field that evaluates to true when retries are exhausted or manually dead-lettered.
global String Direction__cDirection of the API call: Outbound (Salesforce calling external system) or Inbound (external system calling Salesforce).
global String ErrorMessages__cError messages encountered during API call processing.
global Decimal HandlerDurationMs__cTime taken by the API handler to process the request, including validations, queries, and data transforms, in milliseconds.
global String HttpMethod__cThe HTTP method (verb) used for this API call: GET, POST, PUT, PATCH, or DELETE.
global String IdempotencyKey__cIdempotency ensures that processing the same API request multiple times produces the same result as processing it once.
global String IdempotencyKeyBodyHash__cSHA-256 hex digest of the inbound request body, captured when the call was first processed.
global Boolean IsIdempotencyHit__cIndicates the response was returned from a previous API call with the same idempotency key, without re-executing the handler.
global Boolean IsMockedResponse__cIndicates the response was generated by the API handler's mock class rather than an actual external callout.
global String LoggerContext__cSerialized logger context from originating transaction.
global Boolean ManualDeadLetter__cAdmin override to permanently dead-letter a failed API call.
global Decimal MaxRetries__cMaximum retry attempts for this API call.
global Datetime NextRetry__cScheduled date/time for the next retry attempt.
global String ParentSpanId__cW3C Trace Context parent span ID (16 hex characters).
global String Request__cThe serialized request payload (JSON or XML) sent to the external web service.
global String RequestParameters__cName-value pairs of parameters passed to the API service handler for processing.
global String Response__cThe serialized response payload (JSON or XML) received from the external web service.
global Decimal Retries__cThe number of scheduled retry attempts for this web service call.
global String ServiceName__cThe fully qualified name of the API service handler class that processes this call.
global String Status__cCurrent processing status: Queued (awaiting), Processing (in progress), Completed (success), Failed (error), Retry/Retrying (auto-retry), Batched (batch processing), or Aborted (service validation chose not to proceed).
global String StatusCode__cThe HTTP response status code returned by the external service (e.g.
global Decimal TotalDurationMs__cTotal processing time in milliseconds.
global String TraceId__cW3C Trace Context trace ID (32 hex characters) for distributed tracing across API calls.
global String TriggeringRecordId__cThe Salesforce record Id that initiated this web service call.
global String TriggeringRecordUrl__cFormula-generated hyperlink to the record that initiated this API call.
global String URL__cThe full endpoint URL to which the HTTP request was sent.

Field Details

ApiIssues__r

apex
global List<ApiIssue__c> ApiIssues__r

Reciprocal relationship for ApiIssue__c.ApiCall__c .

CalloutDurationMs__c

apex
global Decimal CalloutDurationMs__c

Time taken for the actual HTTP callout to the external service, in milliseconds. Measures network round-trip time excluding handler processing and DML.

Field Attributes:

AttributeValue
Data TypeNumber(6,0)
Requiredfalse
Uniquefalse
External IDfalse

CommitDurationMs__c

apex
global Decimal CommitDurationMs__c

Time taken to commit (DML) records produced by the API handler, in milliseconds. Part of the total duration breakdown alongside handler and callout durations.

Field Attributes:

AttributeValue
Data TypeNumber(6,0)
Requiredfalse
Uniquefalse
External IDfalse

DeadLettered__c

apex
global Boolean DeadLettered__c

Formula field that evaluates to true when retries are exhausted or manually dead-lettered. Dead-lettered calls are permanently failed and skipped by retry logic.

Field Attributes:

AttributeValue
Data TypeCheckbox
FormulaOR( AND( TEXT(Status__c) = "Failed", Retries__c >= MaxRetries__c ), ManualDeadLetter__c = TRUE )

Direction__c

apex
global String Direction__c

Direction of the API call: Outbound (Salesforce calling external system) or Inbound (external system calling Salesforce).

Field Attributes:

AttributeValue
Data TypePicklist
Requiredfalse

Picklist Values:

API NameLabelActive
InboundInboundNo
OutboundOutboundYes

ErrorMessages__c

apex
global String ErrorMessages__c

Error messages encountered during API call processing. May include validation failures, HTTP errors, or exception details. System-populated.

Field Attributes:

AttributeValue
Data TypeLong Text Area(32768)

HandlerDurationMs__c

apex
global Decimal HandlerDurationMs__c

Time taken by the API handler to process the request, including validations, queries, and data transforms, in milliseconds. Excludes callout and commit time.

Field Attributes:

AttributeValue
Data TypeNumber(6,0)
Requiredfalse
Uniquefalse
External IDfalse

HttpMethod__c

apex
global String HttpMethod__c

The HTTP method (verb) used for this API call: GET, POST, PUT, PATCH, or DELETE. Determined by the API handler class. System-populated.

Field Attributes:

AttributeValue
Data TypePicklist
Requiredfalse

Picklist Values:

API NameLabelActive
GETGETYes
POSTPOSTYes
PUTPUTYes
PATCHPATCHYes
DELETEDELETEYes

IdempotencyKey__c

apex
global String IdempotencyKey__c

Idempotency ensures that processing the same API request multiple times produces the same result as processing it once. This field stores the unique key used for duplicate detection. For inbound calls, extracted from the Idempotency-Key request header. For outbound calls, auto-generated as a UUID so the receiving system can detect retries.

Field Attributes:

AttributeValue
Data TypeText(255)
Requiredfalse
Uniquefalse
External IDtrue

IdempotencyKeyBodyHash__c

apex
global String IdempotencyKeyBodyHash__c

SHA-256 hex digest of the inbound request body, captured when the call was first processed. On a subsequent inbound call with the same Idempotency-Key, the framework compares the new request body's hash against this value: if they match, the original cached response is returned; if they differ, the framework rejects with HTTP 409 to surface the contract violation. Empty for outbound calls and for inbound calls created before the body-hash check shipped (legacy records fall through to the cached-response path on replay).

Field Attributes:

AttributeValue
Data TypeText(64)
Requiredfalse
Uniquefalse
External IDfalse

IsIdempotencyHit__c

apex
global Boolean IsIdempotencyHit__c

Indicates the response was returned from a previous API call with the same idempotency key, without re-executing the handler. Set automatically when an inbound request matches an existing idempotency key on a completed ApiCall__c record.

Field Attributes:

AttributeValue
Data TypeCheckbox
Default Valuefalse

IsMockedResponse__c

apex
global Boolean IsMockedResponse__c

Indicates the response was generated by the API handler's mock class rather than an actual external callout. Set automatically when mocking is enabled via API_MockFactory or feature flags.

Field Attributes:

AttributeValue
Data TypeCheckbox
Default Valuefalse

LoggerContext__c

apex
global String LoggerContext__c

Serialized logger context from originating transaction. Contains correlationId, parentTransactionId, and globalContext for cross-transaction log tracing. System-populated.

Field Attributes:

AttributeValue
Data TypeLong Text Area(32768)

ManualDeadLetter__c

apex
global Boolean ManualDeadLetter__c

Admin override to permanently dead-letter a failed API call. When checked, the call is treated as dead-lettered regardless of retry count.

Field Attributes:

AttributeValue
Data TypeCheckbox
Default Valuefalse

MaxRetries__c

apex
global Decimal MaxRetries__c

Maximum retry attempts for this API call. Populated from ApiSetting__mdt.MaxRetryCount__c during creation. Used by the Dead Letter Queue formula to determine when retries are exhausted.

Field Attributes:

AttributeValue
Data TypeNumber(2,0)
Requiredfalse
Uniquefalse
External IDfalse
Default Value0

NextRetry__c

apex
global Datetime NextRetry__c

Scheduled date/time for the next retry attempt. Calculated from the retry backoff setting in ApiSetting__mdt. Only populated when Status is Retry.

Field Attributes:

AttributeValue
Data TypeDate Time
Requiredfalse

ParentSpanId__c

apex
global String ParentSpanId__c

W3C Trace Context parent span ID (16 hex characters). For inbound calls, the span ID from the incoming traceparent header. For outbound calls, the span ID of the inbound call that triggered this outbound call.

Field Attributes:

AttributeValue
Data TypeText(16)
Requiredfalse
Uniquefalse
External IDfalse

Request__c

apex
global String Request__c

The serialized request payload (JSON or XML) sent to the external web service. Sensitive data is masked before persistence when MaskingTarget__mdt records are wired to this field.

Field Attributes:

AttributeValue
Data TypeLong Text Area(131072)

RequestParameters__c

apex
global String RequestParameters__c

Name-value pairs of parameters passed to the API service handler for processing. These are the inputs provided when the API call was created, used by the handler to build the request.

Field Attributes:

AttributeValue
Data TypeLong Text Area(131072)

Response__c

apex
global String Response__c

The serialized response payload (JSON or XML) received from the external web service. Sensitive data is masked before persistence when MaskingTarget__mdt records are wired to this field.

Field Attributes:

AttributeValue
Data TypeLong Text Area(131072)

Retries__c

apex
global Decimal Retries__c

The number of scheduled retry attempts for this web service call. Pre-incremented when a retry is scheduled (not when it executes), so a retry that has been scheduled but not yet run is reflected in the count. Maximum retries configured in the API Setting record.

Field Attributes:

AttributeValue
Data TypeNumber(2,0)
Requiredfalse
Uniquefalse
External IDfalse
Default Value0

ServiceName__c

apex
global String ServiceName__c

The fully qualified name of the API service handler class that processes this call.

Field Attributes:

AttributeValue
Data TypeText(100)
Requiredfalse
Uniquefalse
External IDfalse

Status__c

apex
global String Status__c

Current processing status: Queued (awaiting), Processing (in progress), Completed (success), Failed (error), Retry/Retrying (auto-retry), Batched (batch processing), or Aborted (service validation chose not to proceed).

Field Attributes:

AttributeValue
Data TypePicklist
Requiredfalse

Picklist Values:

API NameLabelActive
QueuedQueuedYes
AbortedAbortedNo
ProcessingProcessingNo
CompletedCompletedNo
FailedFailedNo
RetryRetryNo
RetryingRetryingNo
BatchedBatchedNo

StatusCode__c

apex
global String StatusCode__c

The HTTP response status code returned by the external service (e.g. 200 = success, 400 = bad request, 401 = unauthorized, 404 = not found, 500 = server error). System-populated after the callout completes.

Field Attributes:

AttributeValue
Data TypeText(50)
Requiredfalse
Uniquefalse
External IDfalse

TotalDurationMs__c

apex
global Decimal TotalDurationMs__c

Total processing time in milliseconds. Sum of Handler Duration, Callout Duration, and Commit Duration. System-populated.

Field Attributes:

AttributeValue
Data TypeNumber(6,0)
Requiredfalse
Uniquefalse
External IDfalse

TraceId__c

apex
global String TraceId__c

W3C Trace Context trace ID (32 hex characters) for distributed tracing across API calls. Links inbound and outbound calls within the same logical operation.

Field Attributes:

AttributeValue
Data TypeText(36)
Requiredfalse
Uniquefalse
External IDfalse

TriggeringRecordId__c

apex
global String TriggeringRecordId__c

The Salesforce record Id that initiated this web service call. Used to link the call back to the originating record (e.g., Account, Case, or custom object).

Field Attributes:

AttributeValue
Data TypeText(80)
Requiredfalse
Uniquefalse
External IDfalse

TriggeringRecordUrl__c

apex
global String TriggeringRecordUrl__c

Formula-generated hyperlink to the record that initiated this API call. Provides one-click navigation from the API call to the source record.

Field Attributes:

AttributeValue
Data TypeText
Requiredfalse
Uniquefalse
External IDfalse
FormulaHYPERLINK("/" + TriggeringRecordId__c , "Open")

URL__c

apex
global String URL__c

The full endpoint URL to which the HTTP request was sent. Composed of the Named Credential base URL and the endpoint path configured in ApiSetting__mdt.

Field Attributes:

AttributeValue
Data TypeUrl
Requiredfalse