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<ApiIssue__c> 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__cTrue when a call has Failed and its retry count has reached its Max Retries, or an administrator ticked Manual Dead Letter.
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 as it was received.
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 Boolean IsPermanentFailure__cTicked when the call failed in a way that sending the same request again cannot fix: the service's code raised a permanent failure.
global List<ApiCall__c> LaterAttempts__rReciprocal relationship for ApiCall__c.PreviousAttempt__c.
global String LoggerContext__cSerialized logger context from originating transaction.
global Boolean ManualDeadLetter__cTicked by an administrator to show a failed call in the Dead Letters list as given up on.
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 Id PreviousAttempt__cThe earlier call this call tried again: the call a Retry or a replay ran again, or, for a request your org received, the earlier failed call with the same Idempotency-Key and body when the service has Idempotency Enabled.
global ApiCall__c PreviousAttempt__rThe earlier call this call tried again: the call a Retry or a replay ran again, or, for a request your org received, the earlier failed call with the same Idempotency-Key and body when the service has Idempotency Enabled.
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__cEvery retry of this call: the ones sent again at once in the same transaction and the ones scheduled for later, added up across runs.
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, no further retry), Retry (scheduled for an automatic retry at Next Retry), Retrying (the retry is running), Batched (batch processing), or Aborted (the call never left your org).
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 record that started this web service call: a Salesforce record ID, or other text of up to 80 characters, such as an order number from another system.
global String TriggeringRecordIndex__cA copy of the Triggering Record ID field, kept so you can find the calls of one record quickly, even with many calls.
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.

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

True when a call has Failed and its retry count has reached its Max Retries, or an administrator ticked Manual Dead Letter. Retry does not read it; a call that must never run again is marked Permanent Failure.

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 as it was received. It is recorded on every inbound call that reaches a handler, with or without an Idempotency-Key. A request refused because no handler can be built for its service keeps only the start of its body and no hash. When a later request arrives with the same Idempotency-Key, its body's hash is compared with this value: if they match, the original answer is returned again; if they differ, the request is refused with HTTP 409. The hash also shows whether the body stored on the call is an exact copy of the body received. Empty for outbound calls and for inbound calls saved before the hash was recorded; such a call with a key returns its original answer to a later request with the same key.

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

IsPermanentFailure__c ​

apex
global Boolean IsPermanentFailure__c

Ticked when the call failed in a way that sending the same request again cannot fix: the service's code raised a permanent failure. A refused request (RequestRefusedException) does not tick it, so it can be run again once the cause is fixed. Retry and Retry Selected never run a ticked call again.

Field Attributes:

AttributeValue
Data TypeCheckbox
External IDfalse
Default Valuefalse

LaterAttempts__r ​

apex
global List<ApiCall__c> LaterAttempts__r

Reciprocal relationship for ApiCall__c.PreviousAttempt__c .

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

Ticked by an administrator to show a failed call in the Dead Letters list as given up on. It does not stop a scheduled retry, and Retry does not read it.

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

PreviousAttempt__c ​

apex
global Id PreviousAttempt__c

The earlier call this call tried again: the call a Retry or a replay ran again, or, for a request your org received, the earlier failed call with the same Idempotency-Key and body when the service has Idempotency Enabled.

Field Attributes:

AttributeValue
Data TypeApiCall__c
Requiredfalse
External IDfalse

PreviousAttempt__r ​

apex
global ApiCall__c PreviousAttempt__r

The earlier call this call tried again: the call a Retry or a replay ran again, or, for a request your org received, the earlier failed call with the same Idempotency-Key and body when the service has Idempotency Enabled.

Field Attributes:

AttributeValue
Data TypeApiCall__c
Requiredfalse
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

Every retry of this call: the ones sent again at once in the same transaction and the ones scheduled for later, added up across runs. A scheduled retry is counted when it is scheduled. When the count reaches Max Retries the call is not retried again.

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, no further retry), Retry (scheduled for an automatic retry at Next Retry), Retrying (the retry is running), Batched (batch processing), or Aborted (the call never left your org).

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 record that started this web service call: a Salesforce record ID, or other text of up to 80 characters, such as an order number from another system. Used to link the call back to where it came from.

Field Attributes:

AttributeValue
Data TypeText(80)
Requiredfalse
Uniquefalse
External IDfalse

TriggeringRecordIndex__c ​

apex
global String TriggeringRecordIndex__c

A copy of the Triggering Record ID field, kept so you can find the calls of one record quickly, even with many calls. It is filled on every save with the value exactly as written, a record Id or any other text, and is blank when the source is blank. Calls saved before this field existed may have it blank.

Field Attributes:

AttributeValue
Data TypeText(80)
Requiredfalse
Uniquefalse
External IDtrue

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