How to detect if Jira instance is Cloud or Server using REST API

I need to determine whether I’m working with Jira Cloud or Server (self-hosted) through API calls. When I fetch field information via REST API, I noticed the responses are slightly different. The cloud version includes a “key” property in the field data, but the server version doesn’t have this property.

Response from Jira Cloud when fetching fields:

[
    {
        "id": "priority",
        "name": "Priority",
        "key": "priority",
        "custom": false,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "priority"
        ],
        "schema": {
            "type": "priority",
            "system": "priority"
        }
    }
]

Response from Jira Server when fetching fields:

[
    {
        "id": "priority",
        "name": "Priority",
        "custom": false,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "priority"
        ],
        "schema": {
            "type": "priority",
            "system": "priority"
        }
    }
]

I need to make various API calls for creating issues, updating them, and other operations. Checking for the “key” field every time isn’t practical for my use case. Is there a specific API endpoint that can tell me which type of Jira instance I’m connecting to?

Try the /rest/api/2/configuration endpoint instead. Server instances will return config details including license info, but Cloud instances throw a 403 or 404 since they lock down config access. I’ve used this across tons of client setups and it’s super reliable. Basically, it checks if you’ve got admin access to config settings - which you always have on Server but never on Cloud. Way cleaner than trying to parse user objects or server info that changes between versions.

Use the /rest/api/2/serverInfo endpoint - it’s perfect for this. Cloud instances return deploymentType: Cloud while Server instances either skip this field entirely or set it to Server (depends on version). I’ve used this in production for over a year and it’s rock solid across different Jira versions. You’ll also get other useful info like baseUrl format - Cloud always uses atlassian.net domains, Server uses your custom domain. Way more reliable than checking field properties since those change between configurations and versions.

hit the /rest/api/2/myself endpoint - cloud instances return a different user object structre than server. cloud uses accountId while server uses key for user idntification. way simpler than parsing serverinfo and it’s worked consistently across evry jira version I’ve tested.