Upload a New File

POST /api/0/projects/{organization_slug}/{project_slug}/releases/{version}/files/

Upload a new file for the given release.

Unlike other API requests, files must be uploaded using the traditional multipart/form-data content-type.

The optional ‘name’ attribute should reflect the absolute path that this file will be referenced as. For example, in the case of JavaScript you might specify the full web URI.

Path Parameters:
  • organization_slug (string) – the slug of the organization the release belongs to.
  • project_slug (string) – the slug of the project to change the release of.
  • version (string) – the version identifier of the release.
Parameters:
  • name (string) – the name (full path) of the file.
  • dist (string) – the name of the dist.
  • file (file) – the multipart encoded file.
  • header (string) – this parameter can be supplied multiple times to attach headers to the file. Each header is a string in the format key:value. For instance it can be used to define a content type.
Authentication:required
Method:POST
Path:/api/0/projects/{organization_slug}/{project_slug}/releases/{version}/files/

Example

POST /api/0/projects/the-interstellar-jurisdiction/pump-station/releases/e48e7b5b90327ea1a4d1a4360c735eee7b536f82/files/ HTTP/1.1
Authorization: Bearer {base64-encoded-key-here}
Host: sentry.io
Content-Type: multipart/form-data; boundary=cde088f87d2f441ea66ea3ab74245f2b

--cde088f87d2f441ea66ea3ab74245f2b
Content-Disposition: form-data; name="header"

Content-Type:text/plain; encoding=utf-8
--cde088f87d2f441ea66ea3ab74245f2b
Content-Disposition: form-data; name="name"

/demo/hello.py
--cde088f87d2f441ea66ea3ab74245f2b
Content-Disposition: form-data; name="file"; filename="hello.py"

print "Hello World!"
--cde088f87d2f441ea66ea3ab74245f2b--
HTTP/1.1 201 CREATED
Allow: GET, POST, HEAD, OPTIONS
Content-Language: en
Content-Length: 217
Content-Type: application/json
Vary: Accept-Language, Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
  "sha1": "7dc0876d778eae1093028f7bf368d0b95a53ec1a",
  "dist": null,
  "name": "/demo/hello.py",
  "dateCreated": "2018-08-22T18:24:15.908Z",
  "headers": {
    "Content-Type": "text/plain; encoding=utf-8"
  },
  "id": "4",
  "size": 20
}