We use a single Salesforce account as our API/integration account. As an example, we have 3 web applications that make REST API calls to Salesforce using this single account.

I would like to have each application identify themselves when they make an API call so I can better understand how many API calls each application is making.

The administrative report that Salesforce provides called "API Calls Made Within Last 7 Days" shows all the API calls by user, client id and day of the week.

How can I specify a client id with each of my API requests? Some people have mentioned looking at the Setup/Create/Apps section. However, there must be another way of specifying a client name because I can see a client name specified in the report that is not setup in the Apps section.

  • You wouldn't consider using 3 Saleforce users?
    – Keith C
    Jan 6, 2016 at 18:18
  • If user licenses were free I certainly would. We actually have more like 20 apps so paying for a license for each app isn't financially feasible. Jan 6, 2016 at 18:24

2 Answers 2


Another alternative if each of the external applications has their own IP address is to use the Event Logs API and the RestApi Event Type. Note that this would be a paid feature outside a developer edition org.

Part of the RestApi report is the CLIENT_IP column. If each external application has a distinct IP address then they would be easy to identify in the CSV report.

enter image description here

There is also the USER_AGENT column, so you might be able to use a different user agent with each request. I'll try and find out how to decode/control the reported numeric codes.

Update: It would be extremely hacky, but you could use valid browser user agent strings to produce identifiable USER_AGENT values in the event log. E.g. Have one external app send in the Chrome user agent string with the REST API request. Then either vary the version it identifies as in another external app, or have it identify as a completely different browser. There is hope that a pilot program will add support for custom user agent strings.

  • To Salesforce our applications won't have different IP addresses. Jan 7, 2016 at 22:44
  • @JustinHelgerson Depending on how much of a hack solution you want to use, you could use valid browser user agent strings with each distinct external app. Less than ideal, but it could be made to work. Jan 7, 2016 at 23:01
  • Well that's certainly an interesting idea. We're using the REST API server-side with a C# wrapper that I created around it. We certainly could add a user-agent to the HTTP request though. What tool were you using to view the Event Logs data pictured above? Or is that a simple app you created to view the results? Jan 8, 2016 at 0:42
  • @JustinHelgerson I'm using the FuseIT SFDC Explorer v2.12 it's something I put together at work to play with the various APIs. It is free to download and use. Jan 8, 2016 at 0:47
  • Thanks for all your help so far. Is there a way to view the "RestApi" Event Log data in Salesforce or is it via the API only? Do you also know if calls to the Event Log API count towards the API call limit? I'm trying to find this info in their docs, but over the years it's felt like their documentation has become very scattered. I'd be interested in looking at the Event Log data, but if it counts towards my API call count then I want to make sure I'm careful about how I query the data. Jan 8, 2016 at 1:24

You need to use Setup/Create/Apps to specify a client ID if you're using OAuth/REST. This allows you to specify the appropriate scope, API restrictions, etc, and, most importantly, allows you to identify a particular client between different clients that are using the same credentials. It's entirely possible to see names that are not included in the Apps list, because OAuth apps do not need to be defined in your org to show a particular value. It is, however, defined in some org somewhere. There is no header or option you can set to specify a client ID; it occurs as part of the authentication process, which causes a particular session ID to become bound to a specific client ID. In addition, apps that use SOAP and are officially sanctioned by salesforce.com will have a SOAP client ID that behaves in much the same way; using this unique client ID is how those apps appear under their own usage. This includes apps like the Data Loader (provided by salesforce.com), as well as third-party apps that can be installed in your org.

  • Thanks for the detailed answer. We currently use the REST API and I have connected app setup. We've been using it for years now. Do you know why this connected app name doesn't appear in the report? The client column is just blank. When authenticating we specify our client id, secret, username and password. Jan 6, 2016 at 19:16
  • @JustinHelgerson If you're using username/password, I don't think it shows a client name under the API. You need to be using a client or server flow, not the password flow.
    – sfdcfox
    Jan 6, 2016 at 19:44
  • @sfdcfox - this is interesting, how does this help if one wanted to write validation rules or apex logic that depended on some clientX? (I've always used separate users for each integration client)
    – cropredy
    Jan 6, 2016 at 19:53
  • @crop1645 I don't think you can determine the client in a validation rule or even a trigger (unless, of course, it's within a Visualforce context). The only reason for using different client IDs is to track down how many calls are coming from which source.
    – sfdcfox
    Jan 6, 2016 at 20:10
  • It sounds like I'm out of luck on this. We use the username and password flow because we just need a single API account to make the calls on behalf of our users (our users in this case don't have Salesforce access). Jan 7, 2016 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .