I'm adding a Case via the REST API, but the OwnerId field isn't being set.

I've also tried updating the Case record afterwards, and still the OwnerId isn't updated.

I am able to set/update the Case OwnerId via Apex and the Salesforce UI, with the same user.

RESP API request body (where OwnerId is the ID of the Queue to assign the Case to):

    "Subject": "Test Case",
    "Comments": "This is a test. Please ignore.",
    "Origin": "Web",
    "SuppliedEmail": "[email protected]"


    "success": true,
    "errors": []

The following Apex, ran with the same user, works as expected:

Case c = new Case();
c.Subject = 'Test Case';
c.Comments = 'This is a test. Please ignore.';
c.Origin = 'Web';
c.SuppliedEmail = '[email protected]';
insert c;

1 Answer 1


This is applicable for both Lead and Case.

This is a known issue, If your Org has active Lead assignment rule, you can't set the Owner properly with the normal REST API call. Please find the details in this Salesforce Article.

You have to include the Sforce-Auto-Assign request header and set it to false in REST API requests to prevent assignment rules from running.

You can do this with Composite API as below.

Composite API URL : /services/data/v56.0/composite

Request Body:

  "allOrNone": false,
  "compositeRequest": [
      "referenceId": "refLead",
      "method": "POST",
      "url": "/services/data/v56.0/sobjects/Lead",
      "body": {
        "FirstName": "Demo",
        "LastName": "Demo",
        "Company" : "ABC Inc.",
        "OwnerId": "00G...."
      "httpHeaders": {
        "Sforce-Auto-Assign": "FALSE"
  • I think you mean Case or Lead assignment rules
    – cropredy
    Feb 15, 2023 at 20:16
  • @cropredy - The issue exists for both Lead and Case Object. Thanks for the catch, I didn't realize while posting the answer.
    – Saroj Bera
    Feb 16, 2023 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .