> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sourcemaps API

Sourcemaps are used to get the original line and column number from a backtrace pointing to a minified or transpiled file.

We recommend using [public sourcemaps](/front-end/sourcemaps#public-sourcemaps) whenever possible. Builds that produce lots of sourcemaps can take a long time to upload via our private sourcemap endpoint.

This API provides an easy way to upload private sourcemaps for use with [frontend errors](/front-end/sourcemaps).

<Warning>
  Private sourcemaps will not be used to resolve Node.js backtraces.

  Follow the [Node.js installation instructions](/nodejs/3.x/installation#typescript-support) to configure your application to emit sourcemapped backtraces.
</Warning>

## Create sourcemap

This endpoint enables the creation of private sourcemaps.

|                          |                                                           |
| ------------------------ | --------------------------------------------------------- |
| Endpoint                 | `/api/sourcemaps`                                         |
| Request method           | `POST`                                                    |
| Content-Type             | `multipart/form-data`                                     |
| Requires authentication? | Yes ([Push API key](/appsignal/terminology#push-api-key)) |
| Response formats         | JSON                                                      |

### Matching sourcemaps

We will match the values for the `name[]` fields against the full backtrace URL. For example, the following backtrace line:

```shell Shell theme={null}
  at https://test.local/main.abc123.js:1:92623
```

Will match with the `name`: `https://test.local/main.abc123.js`.
You can add multiple `name`'s in one curl request:

<CodeGroup>
  ```bash Bash theme={null}
  curl -k -X POST -H 'Content-Type: multipart/form-data' \
    -F 'name[]=https://test.local/main.abc123.js' \
    -F 'name[]=https://cdn.local/main.abc123.js' \
    -F 'revision=abcdef' \
    -F 'file=@/~project/main.js.map' \
    'https://appsignal.com/api/sourcemaps?push_api_key=xxx&app_name=AppSignal&environment=development'
  ```
</CodeGroup>

Note that you can only upload one sourcemap file at a time, so if you have multiple sourcemap files, you will have to send an upload request for each file separately. The maximum upload size allowed for a sourcemap file is 100MB.

### Parameters

All parameters, except for `file` can be sent either in the `POST` body or as `GET` parameters. All parameters are **required**.

| Parameter      | Type             | Description                                                                                                                                                       |
| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `push_api_key` | String           | Your organization's{" "} [Push API key](/appsignal/terminology#push-api-key).                                                                                     |
| `app_name`     | String           | Name of the application in AppSignal in which the sourcemap should be used.                                                                                       |
| `environment`  | String           | Environment of the application in AppSignal in which the sourcemap should be used.                                                                                |
| `revision`     | String           | [Deploy marker](/application/markers/deploy-markers){" "} revision reference.                                                                                     |
| `name`         | Array of Strings | List of filenames that the sourcemap covers. This should be a full URL to the minified JavaScript file, as you see it in the backtrace, including any url params. |
| `file`         | File             | Sourcemap to upload.                                                                                                                                              |

### Responses

* The API will return a `201` HTTP status code if successful.
* The API will return a `400` HTTP status code with a JSON response when a validation error has occurred.
* The API will return a `404` HTTP status code if no app exists for the given app name, environment and Push API key combination.

400 response body example:

<CodeGroup>
  ```json JSON theme={null}
  { "errors": ["The following errors were found: Name can't be empty"] }
  ```
</CodeGroup>

### Example

<CodeGroup>
  ```bash Bash theme={null}
  curl -k -X POST -H 'Content-Type: multipart/form-data' \
    -F 'name[]=https://localhost:3000/application.min.js?vsn=d ' \
    -F 'revision=abcdef' \
    -F 'file=@/~project/application.js.map' \
    'https://appsignal.com/api/sourcemaps?push_api_key=xxx&app_name=MyApp&environment=development'
  ```
</CodeGroup>
