Source map upload APIedit

This documentation refers to the API of the standalone (legacy) APM Server. This method of running APM Server will be deprecated and removed in a future release. Please consider upgrading to Fleet and the APM integration. If you’ve already upgraded, see Create and upload source maps (RUM).

You must enable RUM support in the APM Server for this endpoint to work.

The APM Server exposes an API endpoint to upload source maps for real user monitoring (RUM). See the create and upload source maps guide to get started.

If you’re using the APM integration, you must use the Kibana source map upload API instead.

Upload endpointedit

Send a HTTP POST request with the Content-Type header set to multipart/form-data to the source map endpoint:

Request Fieldsedit

The request must include some fields needed to identify source map correctly later on:

  • service_name
  • service_version
  • sourcemap - must follow the Source map revision 3 proposal spec and be attached as a file upload.
  • bundle_filepath - the absolute path of the final bundle as it is used in the web application

You can configure an API key or secret token to restrict sourcemap uploads.

How source maps are appliededit

APM Server attempts to find the correct source map for each stack trace frame in an event. To do this, it tries the following:

  • Compare the event’s with the source map’s service_name
  • Compare the event’s service.version with the source map’s service_version
  • Compare the stack trace frame’s abs_path with the source map’s bundle_filepath

While comparing the stack trace frame’s abs_path with the source map’s bundle_filepath, the search logic will prioritize abs_path full matching:

  "sourcemap.bundle_filepath": "http://localhost/static/js/bundle.js"

But if there is no full match, it also accepts source maps that match only the URLs path (without the host).

  "sourcemap.bundle_filepath": "/static/js/bundle.js"

If a source map is found, the stack trace frame attributes filename, function, line number, and column number are overwritten, and abs path is cleaned to be the shortest path name equivalent to the given path name. If multiple source maps are found, the one with the latest upload timestamp is used.


Example source map request including an optional secret token "mysecret":

curl -X POST \
  -H "Authorization: Bearer mysecret" \
  -F service_name="test-service" \
  -F service_version="1.0" \
  -F bundle_filepath="http://localhost/static/js/bundle.js" \