How to determine if a Jira instance is Cloud or On-Premises using API

I’m currently dealing with various Jira instances and I need to distinguish between cloud versions and on-premises setups based on API responses.

When I retrieve field data, I observed that the cloud version includes a distinct “key” field in its JSON output, whereas the on-premises version lacks this attribute.

I require a consistent method to differentiate between the two versions, as my application will be making a series of API calls for tasks such as creating issues, updating fields, and retrieving information. Simply relying on the presence of one field won’t suffice for all my operations.

Example response from Jira Cloud when fetching fields:

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

Example response from Jira On-Premises when fetching fields:

[
    {
        "id": "issuetype",
        "name": "Issue Type",
        "custom": false,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "issuetype",
            "type"
        ],
        "schema": {
            "type": "issuetype",
            "system": "issuetype"
        }
    }
]

Is there a specific API method or endpoint that I can use to identify whether the instance is cloud-based or on-premises?

Check the deploymentType field in your serverinfo response - cloud shows “Cloud” and on-premise shows “Server”. Cloud instances also don’t expose JVM memory details like server versions do. I’ve been using this method for months and it’s way more reliable than checking individual field schemas, which change too much.

The URL structure is a dead giveaway most developers miss. Cloud instances always use https://yourcompany.atlassian.net while on-premises uses custom domains or IP addresses. You can grab this programmatically from the base URL you’re hitting. Cloud instances also have stricter rate limiting headers compared to on-premises setups. Try checking /rest/api/2/application-properties - cloud returns filtered properties while on-premises gives you detailed system config data. I usually combine URL pattern matching with a serverInfo call as backup.

I always use the /rest/api/2/serverInfo endpoint - it’s the most reliable method I’ve found and works across different Jira versions. Cloud instances return deployment type info, while on-premises gives you server details like build numbers and version strings with different patterns. Cloud versions have shorter, sanitized info and don’t expose the detailed server config data you get with on-premises installations. I make this my first API call before doing anything else. Way more dependable than checking individual field structures, which change based on plugins and customizations.