# Salesforce dependency index: the source of truth.
#
# Everything Salesforce-side that even-simpler-salesforce depends on. Review it against each
# Salesforce release (three a year):
#   https://help.salesforce.com/s/articleView?id=release-notes.salesforce_release_notes.htm&type=5
#   https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_whats_new.htm
#
# - tests/unit/test_salesforce_index.py checks the code against this file.
# - docs/salesforce-dependencies.md is generated from it:
#     python scripts/render_sf_index.py          # regenerate
#     python scripts/render_sf_index.py --check  # CI / tests
# - `checked`: the date (YYYY-MM-DD) someone last compared the entry with the official docs.
#   null = not checked yet. The docs links were added from the documented URL layout and
#   still need that check.
# - Paths are relative to /services/data/vXX.X/ unless they start with /services/.
#   `{}` marks a value filled in at runtime.

last_full_review: null

api_versions:
  default: "68.0"      # DEFAULT_API_VERSION (_async/client.py)
  minimum: "59.0"      # MIN_API_VERSION (_async/client.py)
  end_of_life_policy: https://help.salesforce.com/s/articleView?id=000354473&type=1

rest_endpoints:
  - path: query
    methods: [GET]
    used_by: "sf.query, sf.query_iter, sf.count, sf.query_one, sf.query_first (?q=); sf.explain (?explain=, Salesforce Beta)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm
    checked: null
    # ?explain= (sf.explain): fields checked 2026-11-09 against
    # https://developer.salesforce.com/docs/atlas.en-us.264.0.api_rest.meta/api_rest/dome_query_explain.htm (V22)
  - path: queryAll
    methods: [GET]
    used_by: "sf.query(..., include_deleted=True)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_queryall.htm
    checked: null
  - path: "query/{}"
    methods: [GET]
    used_by: "sf.query_more, sf.query_iter (nextRecordsUrl, absolute path)"
    dynamic: true  # the path comes from the opaque cursor, not a literal in the code
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm
    checked: null
  - path: search
    methods: [GET]
    used_by: "sf.search (?q= SOSL)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search.htm
    checked: null
  - path: parameterizedSearch
    methods: [POST]
    used_by: sf.parameterized_search
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized.htm
    checked: null
  - path: graphql
    methods: [POST]
    used_by: "sf.graphql, sf.graphql_iter (body {query, variables}; errors[] on 200 OK)"
    docs: https://developer.salesforce.com/docs/platform/graphql/guide/requests-and-responses.html
    checked: null
    # Read 2026-11-10 from search excerpts only (the page returns 403 to non-browser clients) (V50, V51)
  - path: "ui-api/records/{}"
    methods: [GET]
    used_by: "sf.ui.record() (fields, layoutTypes, modes)"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_get.htm
    checked: 2026-11-12
  - path: "ui-api/object-info/{}"
    methods: [GET]
    used_by: "sf.ui.object_info() (describe cache; revalidated with If-None-Match: If-Modified-Since is ignored, V62)"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_object_info.htm
    checked: null
  - path: "ui-api/object-info/{}/picklist-values/{}"
    methods: [GET]
    used_by: "sf.ui.picklist_values() (describe cache)"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values_collection.htm
    checked: null
  - path: "ui-api/record-defaults/create/{}"
    methods: [GET]
    used_by: "sf.ui.create_defaults() (recordTypeId)"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_create.htm
    checked: null
  - path: "ui-api/record-defaults/clone/{}"
    methods: [GET]
    used_by: "sf.ui.clone_defaults()"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_clone.htm
    checked: null
  - path: "ui-api/list-info/{}"
    methods: [GET]
    used_by: "sf.ui.list_views() (V60)"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_lists_object_get.htm
    checked: null
  - path: "ui-api/list-records/{}/{}"
    methods: [GET]
    used_by: "sf.ui.list_records() (pageSize 1-2,000, pageToken)"
    dynamic: true  # built by core/ui.py, not a literal in the area code
    docs: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_list_views_records.htm
    checked: null
    # UI API pages read 2026-11-11 from search excerpts only (403 to non-browser clients) (V60-V64)
  - path: limits
    methods: [GET]
    used_by: sf.limits
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_limits.htm
    checked: null
  - path: sobjects
    methods: [GET]
    used_by: "sf.describe_global() (If-Modified-Since → 304)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_describeGlobal.htm
    checked: null
  - path: "sobjects/{}"
    methods: [GET]
    used_by: sobject.metadata()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_basic_info.htm
    checked: null
  - path: "sobjects/{}/"
    methods: [POST]
    used_by: sobject.create()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_basic_info.htm
    checked: null
  - path: "sobjects/{}/describe"
    methods: [GET]
    used_by: "sobject.describe() (If-Modified-Since → 304)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_describe.htm
    checked: null
  - path: "sobjects/{}/{}"
    methods: [GET, PATCH, DELETE]
    used_by: "sobject.get/update/delete() by id"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve.htm
    checked: null
  - path: "sobjects/{}/{}/{}"
    methods: [GET, PATCH]
    used_by: "sobject.get_by_external_id/upsert() (300 on multiple matches)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_upsert.htm
    checked: null
  - path: "sobjects/{}/updated/"
    methods: [GET]
    used_by: sobject.updated(start, end)
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getupdated.htm
    checked: null
  - path: "sobjects/{}/deleted/"
    methods: [GET]
    used_by: sobject.deleted(start, end)
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_getdeleted.htm
    checked: null
  - path: sobjects/ContentVersion
    methods: [POST]
    used_by: "sf.files.upload() (multipart: entity_content JSON + VersionData file; 2 GB max)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm
    checked: null
    # Part names and the 2 GB limit read 2026-11-10 from search excerpts of this page (V12, V29)
  - path: "sobjects/ContentVersion/{}/VersionData"
    methods: [GET]
    used_by: "sf.files.download() (streamed), sf.files.download_bytes()"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_blob_retrieve.htm
    checked: null
  - path: "sobjects/Attachment/{}/Body"
    methods: [GET]
    used_by: sf.files.download_attachment()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_blob_retrieve.htm
    checked: null
  - path: sobjects/ContentDocumentLink
    methods: [POST]
    used_by: "sf.files.link(), sf.files.upload(share_type=/visibility=)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentdocumentlink.htm
    checked: null
  - path: "jobs/{}"
    methods: [POST]
    used_by: "sf.bulk.ingest() (jobs/ingest), sf.bulk.query() and sf.bulk.start_query() (jobs/query, operation query or queryAll)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/create_job.htm
    checked: 2026-11-10
  - path: "jobs/ingest/{}"
    methods: [GET, PATCH]
    used_by: "job.wait(), job.refresh(), sf.bulk.ingest_job() (job info); upload close and job.abort() (state UploadComplete / Aborted)"
    dynamic: true  # built in the API version of the job (_job_path)
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/get_job_info.htm
    checked: null
  - path: "jobs/ingest/{}/batches"
    methods: [PUT]
    used_by: "sf.bulk.ingest() upload (text/csv; charset=UTF-8, streamed, at most 100 MB raw per job)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/upload_job_data.htm
    checked: null
  - path: "jobs/ingest/{}/{}"
    methods: [GET]
    used_by: "job.successful_results(), job.failed_results(), job.unprocessed_records() (CSV)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/get_job_successful_results.htm
    checked: null
  - path: "jobs/query/{}"
    methods: [GET, PATCH]
    used_by: "sf.bulk.query() and job.wait() polling, sf.bulk.query_job() (job info); job.abort() (state Aborted)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_one_job.htm
    checked: null
  - path: "jobs/query/{}/results"
    methods: [GET]
    used_by: "sf.bulk.query(), job.rows() and job.pages() result pages (?locator=&maxRecords=, Sforce-Locator; same API version or 409)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_job_results.htm
    checked: null
  - path: "jobs/query/{}/resultPages"
    methods: [GET]
    used_by: "sf.bulk.query(parallel_downloads>1) (API 58.0+, up to five result URLs per response)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_bulk_v2/query_get_parallel_job_results.htm
    checked: 2026-11-10
  - path: composite/sobjects
    methods: [POST, PATCH, DELETE]
    used_by: collections.create/update/delete()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections.htm
    checked: null
  - path: "composite/sobjects/{}"
    methods: [POST]
    used_by: collections.retrieve()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_retrieve.htm
    checked: null
  - path: "composite/sobjects/{}/{}"
    methods: [PATCH]
    used_by: collections.upsert()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_upsert.htm
    checked: null
  - path: tooling/query
    methods: [GET]
    used_by: "sf.tooling.query, sf.tooling.query_iter (?q=); the capture_log flow of execute_anonymous"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
    checked: null
  - path: "tooling/query/{}"
    methods: [GET]
    used_by: "sf.query_more (Tooling cursors), sf.tooling.query_iter (nextRecordsUrl, absolute path)"
    dynamic: true  # the path comes from the opaque cursor, not a literal in the code
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
    checked: null
  - path: tooling/sobjects
    methods: [GET]
    used_by: "sf.tooling.describe_global (describe cache, own key)"
    dynamic: true  # "sobjects" prefixed at runtime with base="tooling/"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
    checked: null
  - path: "tooling/sobjects/{}"
    methods: [GET, POST, PATCH, DELETE]
    used_by: "sf.tooling.sobject(name) methods (the sf.sobject paths with a tooling/ prefix); TraceFlag and DebugLevel in execute_anonymous(capture_log=True)"
    dynamic: true  # prefixed at runtime by AsyncSObject(base="tooling/")
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
    checked: null
  - path: tooling/executeAnonymous/
    methods: [GET]
    used_by: "sf.tooling.execute_anonymous (?anonymousBody=; never resent, ADR 0001)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
    checked: null
  - path: "tooling/sobjects/ApexLog/{}/Body"
    methods: [GET]
    used_by: "sf.tooling.execute_anonymous(capture_log=True)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_apexlog.htm
    checked: null
  - path: tooling/runTestsAsynchronous/
    methods: [POST]
    used_by: sf.tooling.run_tests_async
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources_testing_runner_async.htm
    checked: null
  - path: tooling/completions
    methods: [GET]
    used_by: "sf.tooling.completions (?type=apex|visualforce)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
    checked: null
  - path: composite
    methods: [POST]
    used_by: composite.builder().send()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite_post.htm
    checked: null
  - path: composite/graph
    methods: [POST]
    used_by: composite.graph().send()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_graph.htm
    checked: null
  - path: composite/batch
    methods: [POST]
    used_by: composite.batch().send()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_batch.htm
    checked: null
  - path: "composite/tree/{}"
    methods: [POST]
    used_by: composite.tree()
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
    checked: null
  # Reports and Dashboards REST API (sf.reports). Paths are built by core/reports.py, so the
  # code scan can't see them (dynamic). Read 2026-11-11 from search excerpts only; the pages
  # return 403 to non-browser clients (V65-V68).
  - path: analytics/reports
    methods: [GET]
    used_by: "sf.reports.recent (up to 200 recently viewed reports; all reports need SOQL on Report)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_recentreportslist.htm
    checked: 2026-11-12
  - path: "analytics/reports/{}"
    methods: [GET, POST]
    used_by: "sf.reports.run (?includeDetails=; POST with reportMetadata.reportFilters; read, resent)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_getreportrundata.htm
    checked: null
  - path: "analytics/reports/{}/describe"
    methods: [GET]
    used_by: sf.reports.describe
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_getbasic_reportmetadata.htm
    checked: null
  - path: "analytics/reports/{}/instances"
    methods: [POST]
    used_by: "sf.reports.run_async (creates a report instance; never resent)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_instances_summaryasync.htm
    checked: null
  - path: "analytics/reports/{}/instances/{}"
    methods: [GET]
    used_by: "sf.reports.instance (polled; status New, Running, Success or Error)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_instances_resource.htm
    checked: null
  - path: "analytics/dashboards/{}"
    methods: [GET, PUT]
    used_by: "sf.reports.dashboards.get (GET), sf.reports.dashboards.refresh (PUT; never resent)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/analytics_api_dashboard_results_resource.htm
    checked: 2026-11-12
  - path: metadata/deployRequest
    methods: [POST]
    used_by: "sf.metadata.deploy() (multipart: json deployOptions + file zip; never resent)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_rest_deploy.htm
    checked: null
    # Part names, the 39 MB zip limit and the response shape read 2026-11-11 from search excerpts (V70)
  - path: "metadata/deployRequest/{}"
    methods: [GET, POST, PATCH]
    used_by: "sf.metadata.deploy_status() (GET ?includeDetails=true; polled with wait=True); sf.metadata.quick_deploy() (POST validatedDeployRequestId; starts a deployment; never resent); sf.metadata.cancel_deploy() (PATCH deployResult.status=Canceling; never resent)"
    dynamic: true
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_rest_deploy_checkstatus.htm
    checked: null
    # Path built by core/metadata.py deploy_request_path(). DeployResult status values (V71).
    # Quick deploy: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_rest_deploy_recentvalidation.htm
    #   (the docs warn that PATCH there starts a new deployment; response shape V86).
    # Cancel: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_rest_deploy_cancel.htm
    #   From API 65.0 a FinalizingDeploy deployment can't be canceled -> DeployNotCancelable (V85).
  - path: "/services/Soap/m/{}"
    methods: [POST]
    used_by: "sf.metadata.retrieve() (retrieve + checkRetrieveStatus), list_metadata() (listMetadata), describe_metadata() (describeMetadata); SOAP Metadata API, SessionHeader = OAuth token"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_calls_intro.htm
    checked: null
    # Envelopes and fault shapes from memory of the Metadata WSDL; fixtures are synthetic (V72, V73)
  - path: /services/oauth2/userinfo
    methods: [GET]
    used_by: sf.auth.userinfo()
    docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_using_userinfo_endpoint.htm&type=5
    checked: null

oauth:
  hosts:
    login: https://login.salesforce.com
    test: https://test.salesforce.com
    my_domain: "https://<name>.my.salesforce.com (required for client credentials)"
  endpoints:
    - path: /services/oauth2/authorize
      methods: [GET]
      used_by: "Web server flow start (code_challenge, S256, state, scope, prompt)"
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_web_server_flow.htm&type=5
      checked: null
    - path: /services/oauth2/token
      methods: [POST]
      used_by: Every grant type below (form-encoded)
      docs: null
      checked: null
    - path: /services/oauth2/revoke
      methods: [POST]
      used_by: sf.auth.revoke()
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_revoke_token.htm&type=5
      checked: null
    - path: /services/oauth2/introspect
      methods: [POST]
      used_by: "sf.auth.introspect(), expiry=\"introspect\" (reads active, exp)"
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oidc_token_introspection_endpoint.htm&type=5
      checked: null
  grant_types:
    - grant_type: authorization_code
      used_by: WebServerFlow.exchange_code (+ PKCE)
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_web_server_flow.htm&type=5
      checked: null
    - grant_type: refresh_token
      used_by: WebServerFlow refresh
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_refresh_token_flow.htm&type=5
      checked: null
    - grant_type: client_credentials
      used_by: ClientCredentials
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_client_credentials_flow.htm&type=5
      checked: null
    - grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer"
      used_by: "JwtBearer (RS256; aud = login/test/My Domain)"
      docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_jwt_flow.htm&type=5
      checked: null
  behaviour:
    - "Token success body: access_token and instance_url (required), id (identity URL; org and user ids parsed from /id/<org>/<user>), issued_at (ms), signature, scope, optional refresh_token (a new one means rotation; saved before use)."
    - "No expires_in: expiry is learnt from a 401, refresh_ahead, or introspection exp."
    - "Errors are {error, error_description}. invalid_grant → ReauthorizationRequired; the text \"token request is already being processed\" → bounded back-off (3 POSTs)."
    - "API calls answer an expired token with 401 and INVALID_SESSION_ID (or OAuth invalid_token): one refresh, one resend, then SessionExpired."

headers:
  - name: Sforce-Call-Options
    direction: request
    used_for: "client_name= → client=<name>; default_namespace= → defaultNamespace=<ns> (joined with '; ')"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_calloptions.htm
    checked: null
  - name: Sforce-Mru
    direction: request
    used_for: "update_mru= → updateMru=true/false (API 60.0+) on sobject create, get, get_by_external_id, update, upsert"
    docs: https://developer.salesforce.com/docs/platform/api-rest/guide/headers-mru.html
    checked: null
  - name: Sforce-Query-Options
    direction: request
    used_for: "page_size= → batchSize=200..2000"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_queryoptions.htm
    checked: null
  - name: Sforce-Auto-Assign
    direction: request
    used_for: "assignment_rule_id= (TRUE / FALSE / rule id)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_autoassign.htm
    checked: null
  - name: Sforce-Duplicate-Rule-Header
    direction: request
    used_for: "duplicate_rules=DuplicateRules(...) → allowSave, includeRecordDetails, runAsCurrentUser (allow_save= deprecated); sObject + Collections create/update/upsert"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_duplicaterules.htm
    checked: 2026-11-13
  - name: If-Modified-Since
    direction: request
    used_for: "describe revalidation, get(if_modified_since=) → 304"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_conditional_requests.htm
    checked: null
  - name: If-None-Match
    direction: request
    used_for: "describe cache revalidation with a stored ETag (UI API object-info and picklist-values, V62) → 304"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_conditional_requests.htm
    checked: null
  - name: If-Unmodified-Since
    direction: request
    used_for: "update(if_unmodified_since=) → 412"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_conditional_requests.htm
    checked: null
  - name: Content-Encoding
    direction: request
    used_for: "gzip for bodies over 64 KiB (Collections)"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_compression.htm
    checked: null
  - name: Sforce-Limit-Info
    direction: response
    used_for: "api-usage=N/M; api-bursts=N/M → sf.usage, budgets"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_api_usage.htm
    checked: null
  - name: Sforce-Locator
    direction: response
    used_for: "next Bulk query result page; the string null on the last page"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_job_results.htm
    checked: null
  - name: Sforce-NumberOfRecords
    direction: response
    used_for: "ResultPage.size: the number of rows in a Bulk query result page"
    docs: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_job_results.htm
    checked: null
  - name: Sforce-Request-Id
    direction: response
    used_for: "error.request_id, sf.request events"
    docs: null
    checked: null
  - name: Retry-After
    direction: response
    used_for: "429 / REQUEST_LIMIT_EXCEEDED back-off (seconds or HTTP date)"
    docs: null
    checked: null
  - name: Warning
    direction: response
    used_for: "299 - \"<text>\" (deprecated API version) → warnings.warn(text, SalesforceWarning) once per text per client family; sf_warning on sf.request"
    docs: https://developer.salesforce.com/docs/platform/api-rest/guide/headers-warning.html
    checked: 2026-11-13
  - name: Last-Modified
    direction: response
    used_for: describe cache revalidation
    docs: null
    checked: null
  - name: ETag
    direction: response
    used_for: describe cache revalidation (stored, sent back as If-None-Match)
    docs: null
    checked: null

response_shapes:
  - resource: Query / QueryAll / query more
    fields: [records, totalSize, done, nextRecordsUrl]
  - resource: Search
    fields: [searchRecords]
  - resource: sObject Collections writes
    fields: ["list, one per input in order", id, success, "errors[]", created]
  - resource: sObject Collections retrieve
    fields: ["list, one per id in order", "null when not found"]
  - resource: Upsert by external id
    fields: [id, created, "201 = created, 204/200 = updated", "300 = list of matching URLs"]
  - resource: Limits
    fields: ["{name: {Max, Remaining, ...}}"]
  - resource: GraphQL
    fields: [data, "errors[]: message, locations, path, extensions.ErrorType", "connections: edges[].node, pageInfo {hasNextPage, endCursor}"]
  - resource: UI API
    fields: ["record: apiName, id, fields {Name: {value, displayValue}}, childRelationships, recordTypeId, eTag, lastModifiedDate, systemModstamp", "list-info: lists[] {apiName, id, label, url}, pageSize 20, nextPageToken", "list-records: records, count, pageSize, currentPageToken, nextPageToken (null on the last page)", "picklist-values: picklistFieldValues {field: {values[] {label, value, validFor}, defaultValue, controllerValues}}", "errors: REST error body; unknown object 403 INSUFFICIENT_ACCESS"]
  - resource: Report run / report instance
    fields: [attributes, allData, hasDetailRows, "factMap {'<row>!<col>': {aggregates[], rows[].dataCells[]}}", "groupingsDown/groupingsAcross.groupings[] {key, value, groupings}", "reportMetadata {reportFormat, detailColumns, aggregates, groupingsDown, groupingsAcross}", "attributes.status (instances)", "empty matrix cells sent with a zero count", "currency detail cell {amount, currency}; currency aggregate a number"]
  - resource: Dashboard results / refresh
    fields: [attributes, dashboardMetadata, "componentData[] {componentId, reportResult (null before the first refresh), status {refreshStatus, componentDataStatus}}", "refresh: 201 {statusUrl}; 409 CONFLICT while running, 403 FORBIDDEN within a minute"]
  - resource: REST error body
    fields: ["list of {message, errorCode or statusCode, fields}", "extras such as duplicateResult"]
  - resource: OAuth error body
    fields: [error, error_description]

# Mapped to typed errors in core/classify.py (CODE_MAP); must match it exactly.
error_codes:
  MALFORMED_QUERY: MalformedQuery
  INVALID_QUERY_LOCATOR: MalformedQuery
  INVALID_QUERY_FILTER_OPERATOR: MalformedQuery
  MALFORMED_SEARCH: MalformedQuery
  INVALID_SEARCH: MalformedQuery
  INVALID_FIELD: InvalidField
  INVALID_FIELD_FOR_INSERT_UPDATE: InvalidField
  INVALID_FIELD_WHEN_USING_TEMPLATE: InvalidField
  INVALID_TYPE: InvalidType
  NOT_FOUND: NotFound
  ENTITY_IS_DELETED: NotFound
  INSUFFICIENT_ACCESS: Forbidden
  INSUFFICIENT_ACCESS_OR_READONLY: Forbidden
  INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: Forbidden
  API_DISABLED_FOR_ORG: Forbidden
  API_CURRENTLY_DISABLED: Forbidden
  FUNCTIONALITY_NOT_ENABLED: Forbidden
  FIELD_CUSTOM_VALIDATION_EXCEPTION: ValidationRuleFailed
  REQUIRED_FIELD_MISSING: RequiredFieldMissing
  DUPLICATES_DETECTED: DuplicateDetected
  INVALID_CROSS_REFERENCE_KEY: InvalidReference
  FIELD_INTEGRITY_EXCEPTION: InvalidReference
  STRING_TOO_LONG: StringTooLong
  INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST: InvalidPicklistValue
  UNABLE_TO_LOCK_ROW: RowLocked
  CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: RecordSaveBlocked
  CANNOT_EXECUTE_FLOW_TRIGGER: FlowFailed
  APEX_FAILED: ApexActionFailed
  STORAGE_LIMIT_EXCEEDED: StorageLimitExceeded
  REQUEST_LIMIT_EXCEEDED: RequestLimitExceeded
  INVALID_SESSION_ID: SessionExpired
  SERVER_UNAVAILABLE: ServerError
  APEX_ERROR: ApexError
  UNSUPPORTED_API_VERSION: UnsupportedApiVersion

other_error_codes:
  - code: ALL_OR_NONE_OPERATION_ROLLED_BACK
    note: skipped when picking the primary error of an all_or_none batch
  - code: PROCESSING_HALTED
    note: Composite subrequest rolled back or skipped because another one failed; skipped by CompositeResult.raise_for_errors()
  - code: BATCH_PROCESSING_HALTED
    note: Batch subrequest skipped after an earlier failure with haltOnError; skipped by CompositeResult.raise_for_errors()

http_statuses: [300, 304, 401, 403, 404, 409, 410, 412, 414, 420, 428, 429, 431, 500, 502, 503, 504]

limits:
  collection_write_chunk: 200    # COLLECTION_WRITE_CHUNK
  collection_read_chunk: 2000    # COLLECTION_READ_CHUNK
  query_batch_size: [200, 2000]  # Sforce-Query-Options validation
  record_id_lengths: [15, 18]    # check_record_id
  gzip_threshold_bytes: 65536    # GZIP_THRESHOLD
  composite_subrequests: 25      # COMPOSITE_MAX (at most 5 of them sObject Collections or query: COMPOSITE_MAX_HEAVY)
  graph_subrequests: 500         # GRAPH_MAX, per graph
  batch_subrequests: 25          # BATCH_MAX
  tree_records: 200              # TREE_MAX_RECORDS (5 types, 5 levels)
