Salesforce cloud logo

HOSTED MOCK API REFERENCE

Salesforce Lead API mock: sessions, validation and allocation

Exercise a lead-capture connector's session recovery with INVALID_SESSION_ID, then distinguish exhausted API allocation from a missing permission. Use required-field and picklist failures to test field mapping before retrying a write.

Explore mock APIs

New registration is paused. Explore the public mock APIs; existing users can still sign in.

Existing user? Configure Salesforce Lead API · Workspace pricing and limits · Supported operations and behaviours

What to assert in your client

Assert HTTP status and the Salesforce error array together. Failure injections precede configured field validation. The optional synthetic OAuth issuer belongs to this test system; it is not Salesforce OAuth and never refreshes a real Salesforce session.

Request and selected response examples

Create Lead: Invalid session

Documented Synthetic illustrative example from the catalogue, not a live capture. Run only after installing your own receiver. Replace <your-receiver-token> locally; no request is sent from this page.

HTTP 401 · INVALID_SESSION_ID

curl / Bash request

printf '%s' '{"FirstName":"Alex","LastName":"Example","Company":"Example Test Co"}' | \
curl -i -X POST \
  'https://nottherealapi.com/r/<your-receiver-token>/services/data/v66.0/sobjects/Lead' \
  -H 'Authorization: Bearer synthetic-module-session' \
  -H 'Content-Type: application/json' \
  --data-binary @-

PowerShell request

$body = '{"FirstName":"Alex","LastName":"Example","Company":"Example Test Co"}'
Invoke-WebRequest `
    -UseBasicParsing `
    -Uri 'https://nottherealapi.com/r/<your-receiver-token>/services/data/v66.0/sobjects/Lead' `
    -Method POST `
    -Headers @{
    Authorization = 'Bearer synthetic-module-session'
    } `
    -ContentType 'application/json' `
    -Body ([Text.Encoding]::UTF8.GetBytes($body))

Selected synthetic response

HTTP 401
content-type: application/json

[
  {
    "message": "Session expired or invalid",
    "errorCode": "INVALID_SESSION_ID",
    "fields": []
  }
]

Create Lead: Org API allocation exceeded

Documented Synthetic illustrative example from the catalogue, not a live capture. Run only after installing your own receiver. Replace <your-receiver-token> locally; no request is sent from this page.

HTTP 403 · REQUEST_LIMIT_EXCEEDED

curl / Bash request

printf '%s' '{"FirstName":"Alex","LastName":"Example","Company":"Example Test Co"}' | \
curl -i -X POST \
  'https://nottherealapi.com/r/<your-receiver-token>/services/data/v66.0/sobjects/Lead' \
  -H 'Authorization: Bearer synthetic-module-session' \
  -H 'Content-Type: application/json' \
  --data-binary @-

PowerShell request

$body = '{"FirstName":"Alex","LastName":"Example","Company":"Example Test Co"}'
Invoke-WebRequest `
    -UseBasicParsing `
    -Uri 'https://nottherealapi.com/r/<your-receiver-token>/services/data/v66.0/sobjects/Lead' `
    -Method POST `
    -Headers @{
    Authorization = 'Bearer synthetic-module-session'
    } `
    -ContentType 'application/json' `
    -Body ([Text.Encoding]::UTF8.GetBytes($body))

Selected synthetic response

HTTP 403
content-type: application/json

[
  {
    "message": "API request limit exceeded",
    "errorCode": "REQUEST_LIMIT_EXCEEDED",
    "fields": []
  }
]

CRM Sales Cloud REST API · v66.0

What can I test with this?

Test integrations that create Salesforce leads without a live Salesforce org. Simulate successful creation, field validation, invalid sessions, insufficient access, exhausted API allocation and temporary service unavailability. Synthetic delays and malformed JSON let you exercise client deadlines and response parsing.

Lead creation validates configured fields and Bearer format. Failure injections precede validation. Synthetic OAuth is a local test issuer, not Salesforce OAuth. Org duplicate rules and actual API allocation are not evaluated.

Useful for

  • Lead capture forms
  • CRM connectors
  • Field mapping
  • Session recovery
  • Retry and error handling

Supported operations

1 operation

Create Lead

POST /services/data/v66.0/sobjects/Lead

Creates a Lead through the Sales Cloud REST API. Send Lead fields such as LastName and Company; the simulated response exercises creation and field-error handling.

Request content type: application/json

Request example

{
  "FirstName": "Alex",
  "LastName": "Example",
  "Company": "Example Test Co"
}

Available behaviours (9)

  • Lead created
    Representative

    Successful sObject Lead creation.

    HTTP 201

    Verify that your client handles a successful response.

  • Invalid session
    Documented

    An absent, expired or invalid session is rejected.

    HTTP 401 · INVALID_SESSION_ID

    Test credential refresh and authentication recovery.

  • Insufficient access
    Representative

    The authenticated user cannot perform this operation.

    HTTP 403 · INSUFFICIENT_ACCESS

    Check how your integration reports missing access or permissions.

  • Required Lead field missing
    Documented

    Required fields are reported using Salesforce's field-error array.

    HTTP 400 · REQUIRED_FIELD_MISSING

    Test field mapping and useful validation feedback.

  • Invalid field value
    Representative

    A field value is not accepted by this representative org profile.

    HTTP 400 · INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST

    Test field mapping and useful validation feedback.

  • Org API allocation exceeded
    Documented

    Salesforce reports API allocation exhaustion as REQUEST_LIMIT_EXCEEDED.

    HTTP 403 · REQUEST_LIMIT_EXCEEDED

    Check that persistent allocation or billing limits do not cause endless retries.

    • Do not treat this org-level quota as an ordinary short retry-after throttle.
  • Service unavailable
    Representative

    Representative temporary platform failure; the error code is an approximation.

    HTTP 503 · SERVER_UNAVAILABLE

    Test recovery and error reporting during simulated service failures.

  • Delayed success
    Synthetic

    Synthetic delay for exercising client deadlines.

    HTTP 201 · 1800 ms delay

    Exercise client deadlines and timeout recovery.

    • Delay is configurable and bounded by the execution engine.
  • Malformed JSON success
    Synthetic

    Synthetic invalid JSON with JSON content type.

    HTTP 200

    Verify that response parsing fails safely.

What NotTheRealAPI controls

NotTheRealAPI does not call Salesforce. No real provider account is required. Your integration sends the request to a NotTheRealAPI receiver and receives the selected provider-shaped response.

The receiver stays under NotTheRealAPI at /r/<receiver-token> followed by the operation path. Selecting a behaviour controls the simulated response on that same receiver.

Scope and safe testing

This independent simulation has no live Salesforce connection or endorsement and does not claim complete API compatibility. No real provider credentials are required. Outcomes remain selected until you change them; these provider fixtures do not persist business records or transition autonomously.

Use synthetic data only. Receiver URLs are secrets. Captured headers and bounded bodies are visible to authorised workspace members without automatic redaction; see privacy and retention.

NotTheRealAPI independently simulates third-party APIs for testing. All provider names and logos are the property of their respective owners. NotTheRealAPI is not affiliated with, sponsored by or endorsed by those providers, and these modules do not connect to their live services. Twilio and all related logos are trademarks of Twilio Inc. or its affiliates.

Browse the full mock API catalogue · Marketo API mock: lead sync and daily quota 607 · Compare workspace limits and pricing · Sign in

Salesforce Lead API Mock: Test Sessions & API Limits | NotTheRealAPI