top of page


There are lots of extensive guides to our API, this is not that. This is an oversimplified tutorial of the Jamf API, for people that hate reading a lot. I’ll be showing you a list of simple one line commands to run from Terminal that will help you understand how to use the Jamf API.

What is the Jamf API for?

You can use the API to get or push data from your Jamf server for use in a script.

Your own personal API documentation

Navigate to your Jamf Pro URL and put /api at the end of it (EG: This is the Jamf API documentation. I’ll be referring to it.

Using the API

To make this as easy as possible, I will first show you the command, then explain what it does. I will underline any part you need to change, and bold any parts I’m adding.

The base command

Every API call starts with this

curl -u username:password


  • curl: A command that transfers data to or from a server

  • -u: a flag for curl that authenticates with user credentials. This is followed by username:password

  • URL: This is where you define what you want to pull from or push to. It always starts with

List of all computers

curl -u username:password

If you want to get a list of all your computers, just put /computers at the end, like so:

If you look at your API documentation, you can easily see how to get a list of other parts of the Jamf server.

The inventory of a specific computer

curl -u username:password{serialnumber}

To get the inventory of a specific computer in your Jamf Server, we need that computer’s serial number. Just put /serialnumber/ followed by the serial number of that computer. This will give you a long, garbled, XML output that includes all your computer’s inventory.

Note how if you click on Computers in your API documentation, it shows you how to do that

The Model of that computer

curl -u username:password{serialnumber} | xpath 'string(/computer/hardware/model)'

Want to get the model of the computer? Just pipe it into xpath by putting | xpath ‘string(/computer/hardware/model)’ onto the end of it. The /computer/hardware/model corresponds to the structure of the XML, so you can easily isolate another part of the inventory.

To make it easier to look at your inventory, to isolate another part, run this command:

curl -u username:password{serialnumber} | xmllint --format -

Pushing Information

Cool, we are getting more complicated. Now I’ll show you how to push information to objects in your server.

Updating the asset tag on a computer’s inventory record

curl -u username:password{serialnumber} -H "Content-Type: application/xml" -d "<computer><general><asset_tag>AssetTag</asset_tag></general></computer>" -X PUT


  • -H: Defines a header, which we need to push XML. Should be followed by “Content-Type: application/xml”

  • -d: Defines the data you want to push. This should be in XML form. We need to start from the top level, so we go computer/general/asset_tag.

  • -X: Defines what type of API call this is. If you’re updating an existing record, it’s a PUT

And that’s it!

Now you’re up and running with the API.

534 views0 comments


bottom of page