Difference between PUT and PATCH

Hello. I am making a script to autoupdate my IP with cURL, but i have a little doubt regarding the way to do it.

What is the difference between PUT and PATCH? Can i use anyone of both, or should i rather use PUT to create a new one and PATCH to update an existing one?

Thank you. Have a nice day.


I believe you are referring to this API:


By definition (from Wikipedia):

The main difference between the PUT and PATCH method is that the PUT method uses the request URI to supply a modified version of the requested resource which replaces the original version of the resource, whereas the PATCH method supplies a set of instructions to modify the resource. If the PATCH document is larger than the size of the new version of the resource sent by the PUT method then the PUT method is preferred.

Basically PATCH is just updating a subset of data, but PUT requires you to submit the full data when you are performing some changes.

So back to the Cloudflare API documentation:



Take a look at “Required parameters” and “Optional parameters”, notice that PUT method requires you to include more information than PATCH method in your request body.

Since you just want to update your IP address, use PATCH method is easier and more efficient, as you don’t have to specify again the type of record (A), record name and also the TTL.

Thank you very much, Eric.

I totally understood what i was looking for.

Indeed, PATCH is more short.

Have a nice day.


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.