Create an API key in SSL curl

Hello,

I can't create an api key with the curl command in SSL.
I have tried different command without success.
Could you tell me the right command? And if I should authenticate with the node certificate or with the CA?

 curl --cert-type P12 --cert certs/node-1.p12:certpassword -XPOST "https://192.168.1.10:9200/_security/api_key?pretty" -u elastic:elasticpassword -H 'Content-Type: application/json' -d'
{
  "name": "my-api-key",   
  "role_descriptors": { 
    "role-a": {
      "cluster": ["all"],
      "index": [
        {
          "names": ["index-a*"],
          "privileges": ["read"]
        }
      ]
    },
    "role-b": {
      "cluster": ["all"],
      "index": [
        {
          "names": ["index-b*"],
          "privileges": ["all"]
        }
      ]
    }
  },
  "metadata": {
    "application": "my-application",
    "environment": {
       "level": 1,
       "trusted": true,
       "tags": ["dev", "staging"]
    }
  }
}
'

Best regards,

I solved the problem by extracting the keys and cert from the client.p12 certificate and I also recovered the crt from the CA
With this command it works:

curl -X POST --cacert "./elastic-stack-ca.crt" --cert "./node-1.crt" --key "./node-1.key" "https://192.168.1.10:9200/_security/api_key?pretty" -u elastic -H 'Content-Type: application/json' -d'
{
  "name": "my-api-key",   
  "role_descriptors": { 
    "role-a": {
      "cluster": ["all"],
      "index": [
        {
          "names": ["index-a*"],
          "privileges": ["read"]
        }
      ]
    },
    "role-b": {
      "cluster": ["all"],
      "index": [
        {
          "names": ["index-b*"],
          "privileges": ["all"]
        }
      ]
    }
  },
  "metadata": {
    "application": "my-application",
    "environment": {
       "level": 1,
       "trusted": true,
       "tags": ["dev", "staging"]
    }
  }
}
'