# ApiCall__c

**Sobject**

<div class="apex-member apex-class">

```apex
global class ApiCall__c extends SObject
```

**Extends:** [SObject](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject.htm)

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.

</div>

---

## Fields

| Field | Description |
|-------|-------------|
| global [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm)<[ApiIssue__c](/reference/objects/apiissue-c)> [ApiIssues__r](#apiissues-r) | Reciprocal relationship for ApiIssue__c.ApiCall__c. |
| global [Decimal](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_decimal.htm) [CalloutDurationMs__c](#calloutdurationms-c) | Time taken for the actual HTTP callout to the external service, in milliseconds. |
| global [Decimal](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_decimal.htm) [CommitDurationMs__c](#commitdurationms-c) | Time taken to commit (DML) records produced by the API handler, in milliseconds. |
| global [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [DeadLettered__c](#deadlettered-c) | True when a call has Failed and its retry count has reached its Max Retries, or an administrator ticked Manual Dead Letter. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [Direction__c](#direction-c) | Direction of the API call: Outbound (Salesforce calling external system) or Inbound (external system calling Salesforce). |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [ErrorMessages__c](#errormessages-c) | Error messages encountered during API call processing. |
| global [Decimal](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_decimal.htm) [HandlerDurationMs__c](#handlerdurationms-c) | Time taken by the API handler to process the request, including validations, queries, and data transforms, in milliseconds. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [HttpMethod__c](#httpmethod-c) | The HTTP method (verb) used for this API call: GET, POST, PUT, PATCH, or DELETE. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [IdempotencyKey__c](#idempotencykey-c) | Idempotency ensures that processing the same API request multiple times produces the same result as processing it once. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [IdempotencyKeyBodyHash__c](#idempotencykeybodyhash-c) | SHA-256 hex digest of the inbound request body as it was received. |
| global [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [IsIdempotencyHit__c](#isidempotencyhit-c) | Indicates the response was returned from a previous API call with the same idempotency key, without re-executing the handler. |
| global [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [IsMockedResponse__c](#ismockedresponse-c) | Indicates the response was generated by the API handler's mock class rather than an actual external callout. |
| global [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [IsPermanentFailure__c](#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. |
| global [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm)<[ApiCall__c](/reference/objects/apicall-c)> [LaterAttempts__r](#laterattempts-r) | Reciprocal relationship for ApiCall__c.PreviousAttempt__c. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [LoggerContext__c](#loggercontext-c) | Serialized logger context from originating transaction. |
| global [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [ManualDeadLetter__c](#manualdeadletter-c) | Ticked by an administrator to show a failed call in the Dead Letters list as given up on. |
| global [Decimal](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_decimal.htm) [MaxRetries__c](#maxretries-c) | Maximum retry attempts for this API call. |
| global [Datetime](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_datetime.htm) [NextRetry__c](#nextretry-c) | Scheduled date/time for the next retry attempt. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [ParentSpanId__c](#parentspanid-c) | W3C Trace Context parent span ID (16 hex characters). |
| global [Id](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm) [PreviousAttempt__c](#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. |
| global [ApiCall__c](/reference/objects/apicall-c) [PreviousAttempt__r](#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. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [Request__c](#request-c) | The serialized request payload (JSON or XML) sent to the external web service. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [RequestParameters__c](#requestparameters-c) | Name-value pairs of parameters passed to the API service handler for processing. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [Response__c](#response-c) | The serialized response payload (JSON or XML) received from the external web service. |
| global [Decimal](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_decimal.htm) [Retries__c](#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. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [ServiceName__c](#servicename-c) | The fully qualified name of the API service handler class that processes this call. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [Status__c](#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). |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [StatusCode__c](#statuscode-c) | The HTTP response status code returned by the external service (e.g. |
| global [Decimal](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_decimal.htm) [TotalDurationMs__c](#totaldurationms-c) | Total processing time in milliseconds. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [TraceId__c](#traceid-c) | W3C Trace Context trace ID (32 hex characters) for distributed tracing across API calls. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [TriggeringRecordId__c](#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. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [TriggeringRecordIndex__c](#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. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [TriggeringRecordUrl__c](#triggeringrecordurl-c) | Formula-generated hyperlink to the record that initiated this API call. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [URL__c](#url-c) | The 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Number(6,0) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Number(6,0) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Checkbox |
| Formula | `OR( 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Picklist |
| Required | false |

**Picklist Values:**

| API Name | Label | Active |
|----------|-------|--------|
| `Inbound` | Inbound | No |
| `Outbound` | Outbound | Yes |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Long 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Number(6,0) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Picklist |
| Required | false |

**Picklist Values:**

| API Name | Label | Active |
|----------|-------|--------|
| `GET` | GET | Yes |
| `POST` | POST | Yes |
| `PUT` | PUT | Yes |
| `PATCH` | PATCH | Yes |
| `DELETE` | DELETE | Yes |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(255) |
| Required | false |
| Unique | false |
| External ID | true |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(64) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Checkbox |
| Default Value | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Checkbox |
| Default Value | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Checkbox |
| External ID | false |
| Default Value | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Long 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Checkbox |
| Default Value | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Number(2,0) |
| Required | false |
| Unique | false |
| External ID | false |
| Default Value | 0 |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Date Time |
| Required | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(16) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | ApiCall__c |
| Required | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | ApiCall__c |
| Required | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Long 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Long 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Long 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Number(2,0) |
| Required | false |
| Unique | false |
| External ID | false |
| Default Value | 0 |

### ServiceName__c

```apex
global String ServiceName__c
```

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

**Field Attributes:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(100) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Picklist |
| Required | false |

**Picklist Values:**

| API Name | Label | Active |
|----------|-------|--------|
| `Queued` | Queued | Yes |
| `Aborted` | Aborted | No |
| `Processing` | Processing | No |
| `Completed` | Completed | No |
| `Failed` | Failed | No |
| `Retry` | Retry | No |
| `Retrying` | Retrying | No |
| `Batched` | Batched | No |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(50) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Number(6,0) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(36) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(80) |
| Required | false |
| Unique | false |
| External ID | false |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text(80) |
| Required | false |
| Unique | false |
| External ID | true |

### 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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Text |
| Required | false |
| Unique | false |
| External ID | false |
| Formula | `HYPERLINK("/" +  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:**

| Attribute | Value |
|-----------|-------|
| Data Type | Url |
| Required | false |
