You get a "too large body" error

Many Identity Cloud operations use request body members as a way to specify properties and property values for Identity Cloud objects. For example, when creating a login policy, you might use a JSON-formatted request body similar to this:

{
     "identityStoreDetails": {
        "type": "janrainCapture",
        "connectionDetails": {
            "domain": "us-dev.janraincapture.com",
            "applicationId": "ces7u7uwwudrxtz933jvbehzne",
            "entityType": "user",
            "clientId": "6s7q89env535ek49hkz6hjsh3jgs93ud",
            "clientSecret": "8c8frzvtxuoqbb7ayewvbgvn67s5dctx"
        }
    },
    "loginURL": "https://v1.api.us.janrain.com/e0a70b4f-1eef-4856-bcdb-f050fee66aae/auth-ui/login",
    "title": "Training Login Policy"
}

Other API operations might use a different approach (e.g., x-www-form-urlencoded), but these operations still rely on the request body.

Typically request bodies are quite small; the login policy example shown a moment ago contains just 507 characters. At times, however, request bodies can be considerably larger; for example, the entity.bulkCreate operation might be used to create several thousand user accounts in a single operation. In turn, that's going to result in a much larger request body, and could even result in a request body too large to be used.

And what does "too large to be used" even mean? Well, by default Identity Cloud request bodies can be no larger than 5 MB; if you try to make an API call with, say, a 6 MB request body, that's going to fail with an error similar to this:

client intended to send too large  body: 6291456 bytes

Your request body can't exceed 5 MB. That's all there is to it.

📘

There are two exceptions to this 5 MB rule: the Published Settings operations and the OAuth User Profile operations. These operations are limited to a maximum request body size of 1 MB. Which, needless to say, is even smaller than 5 MB.

So what can you do if you run into these size limitations? Well, to begin, there's a good chance you won't run into these size limitations: 5 MB (or even 1 MB) is a very large request body. But suppose you do encounter this error when trying to add several thousand new user accounts by using the entity.bulkCreate operation. In that case, you can simply split your user list in half (say, last names A-M and last names N-Z) and then make two calls to the entity.bulkCreate operation: the first time using users A-M and the second time using users N-Z.