0

Add a symbol source to a project

by
Published Oct 17, 2025

Add a custom symbol source to a project.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Add a symbol source to a project
4
 * Add a custom symbol source to a project.
5
 */
6
export async function main(auth: RT.Sentry, project_id_or_slug: string, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/symbol-sources/`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'POST',
13
		headers: {
14
			'Content-Type': 'application/json',
15
			Authorization: 'Bearer ' + auth.token
16
		},
17
		body: JSON.stringify(body)
18
	})
19
	if (!response.ok) {
20
		const text = await response.text()
21
		throw new Error(`${response.status} ${text}`)
22
	}
23
	return await response.json()
24
}
25

26
/* eslint-disable */
27
/**
28
 * This file was automatically generated by json-schema-to-typescript.
29
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
30
 * and run json-schema-to-typescript to regenerate this file.
31
 */
32

33
export interface Body {
34
	/**
35
	 * The type of the source.
36
	 *
37
	 * * `http` - SymbolServer (HTTP)
38
	 * * `gcs` - Google Cloud Storage
39
	 * * `s3` - Amazon S3
40
	 */
41
	type: 'http' | 'gcs' | 's3'
42
	/**
43
	 * The human-readable name of the source.
44
	 */
45
	name: string
46
	/**
47
	 * The internal ID of the source. Must be distinct from all other source IDs and cannot start with '`sentry:`'. If this is not provided, a new UUID will be generated.
48
	 */
49
	id?: string
50
	/**
51
	 * Layout settings for the source. This is required for HTTP, GCS, and S3 sources.
52
	 *
53
	 * **`type`** ***(string)*** - The layout of the folder structure. The options are:
54
	 * - `native` - Platform-Specific (SymStore / GDB / LLVM)
55
	 * - `symstore` - Microsoft SymStore
56
	 * - `symstore_index2` - Microsoft SymStore (with index2.txt)
57
	 * - `ssqp` - Microsoft SSQP
58
	 * - `unified` - Unified Symbol Server Layout
59
	 * - `debuginfod` - debuginfod
60
	 *
61
	 * **`casing`** ***(string)*** - The layout of the folder structure. The options are:
62
	 * - `default` - Default (mixed case)
63
	 * - `uppercase` - Uppercase
64
	 * - `lowercase` - Lowercase
65
	 *
66
	 * ```json
67
	 * {
68
	 *     "layout": {
69
	 *         "type": "native"
70
	 *         "casing": "default"
71
	 *     }
72
	 * }
73
	 * ```
74
	 */
75
	layout?: {
76
		/**
77
		 * The source's layout type.
78
		 *
79
		 * * `native`
80
		 * * `symstore`
81
		 * * `symstore_index2`
82
		 * * `ssqp`
83
		 * * `unified`
84
		 * * `debuginfod`
85
		 * * `slashsymbols`
86
		 */
87
		type:
88
			| 'native'
89
			| 'symstore'
90
			| 'symstore_index2'
91
			| 'ssqp'
92
			| 'unified'
93
			| 'debuginfod'
94
			| 'slashsymbols'
95
		/**
96
		 * The source's casing rules.
97
		 *
98
		 * * `lowercase`
99
		 * * `uppercase`
100
		 * * `default`
101
		 */
102
		casing: 'lowercase' | 'uppercase' | 'default'
103
		[k: string]: unknown
104
	}
105
	/**
106
	 * Filter settings for the source. This is optional for all sources.
107
	 *
108
	 * **`filetypes`** ***(list)*** - A list of file types that can be found on this source. If this is left empty, all file types will be enabled. The options are:
109
	 * - `pe` - Windows executable files
110
	 * - `pdb` - Windows debug files
111
	 * - `portablepdb` - .NET portable debug files
112
	 * - `mach_code` - MacOS executable files
113
	 * - `mach_debug` - MacOS debug files
114
	 * - `elf_code` - ELF executable files
115
	 * - `elf_debug` - ELF debug files
116
	 * - `wasm_code` - WASM executable files
117
	 * - `wasm_debug` - WASM debug files
118
	 * - `breakpad` - Breakpad symbol files
119
	 * - `sourcebundle` - Source code bundles
120
	 * - `uuidmap` - Apple UUID mapping files
121
	 * - `bcsymbolmap` - Apple bitcode symbol maps
122
	 * - `il2cpp` - Unity IL2CPP mapping files
123
	 * - `proguard` - ProGuard mapping files
124
	 *
125
	 * **`path_patterns`** ***(list)*** - A list of glob patterns to check against the debug and code file paths of debug files. Only files that match one of these patterns will be requested from the source. If this is left empty, no path-based filtering takes place.
126
	 *
127
	 * **`requires_checksum`** ***(boolean)*** - Whether this source requires a debug checksum to be sent with each request. Defaults to `false`.
128
	 *
129
	 * ```json
130
	 * {
131
	 *     "filters": {
132
	 *         "filetypes": ["pe", "pdb", "portablepdb"],
133
	 *         "path_patterns": ["*ffmpeg*"]
134
	 *     }
135
	 * }
136
	 * ```
137
	 */
138
	filters?: {
139
		/**
140
		 * The file types enabled for the source.
141
		 */
142
		filetypes?: (
143
			| 'pe'
144
			| 'pdb'
145
			| 'portablepdb'
146
			| 'mach_debug'
147
			| 'mach_code'
148
			| 'elf_debug'
149
			| 'elf_code'
150
			| 'wasm_debug'
151
			| 'wasm_code'
152
			| 'breakpad'
153
			| 'sourcebundle'
154
			| 'uuidmap'
155
			| 'bcsymbolmap'
156
			| 'il2cpp'
157
			| 'proguard'
158
			| 'dartsymbolmap'
159
		)[]
160
		/**
161
		 * The debug and code file paths enabled for the source.
162
		 */
163
		path_patterns?: string[]
164
		/**
165
		 * Whether the source requires debug checksums.
166
		 */
167
		requires_checksum?: boolean
168
		[k: string]: unknown
169
	}
170
	/**
171
	 * The source's URL. Optional for HTTP sources, invalid for all others.
172
	 */
173
	url?: string
174
	/**
175
	 * The user name for accessing the source. Optional for HTTP sources, invalid for all others.
176
	 */
177
	username?: string
178
	/**
179
	 * The password for accessing the source. Optional for HTTP sources, invalid for all others.
180
	 */
181
	password?: string
182
	/**
183
	 * The GCS or S3 bucket where the source resides. Required for GCS and S3 source, invalid for HTTP sources.
184
	 */
185
	bucket?: string
186
	/**
187
	 * The source's [S3 region](https://docs.aws.amazon.com/general/latest/gr/s3.html). Required for S3 sources, invalid for all others.
188
	 *
189
	 * * `us-east-2` - US East (Ohio)
190
	 * * `us-east-1` - US East (N. Virginia)
191
	 * * `us-west-1` - US West (N. California)
192
	 * * `us-west-2` - US West (Oregon)
193
	 * * `ap-east-1` - Asia Pacific (Hong Kong)
194
	 * * `ap-south-1` - Asia Pacific (Mumbai)
195
	 * * `ap-northeast-2` - Asia Pacific (Seoul)
196
	 * * `ap-southeast-1` - Asia Pacific (Singapore)
197
	 * * `ap-southeast-2` - Asia Pacific (Sydney)
198
	 * * `ap-northeast-1` - Asia Pacific (Tokyo)
199
	 * * `ca-central-1` - Canada (Central)
200
	 * * `cn-north-1` - China (Beijing)
201
	 * * `cn-northwest-1` - China (Ningxia)
202
	 * * `eu-central-1` - EU (Frankfurt)
203
	 * * `eu-west-1` - EU (Ireland)
204
	 * * `eu-west-2` - EU (London)
205
	 * * `eu-west-3` - EU (Paris)
206
	 * * `eu-north-1` - EU (Stockholm)
207
	 * * `sa-east-1` - South America (São Paulo)
208
	 * * `us-gov-east-1` - AWS GovCloud (US-East)
209
	 * * `us-gov-west-1` - AWS GovCloud (US)
210
	 */
211
	region?:
212
		| 'us-east-2'
213
		| 'us-east-1'
214
		| 'us-west-1'
215
		| 'us-west-2'
216
		| 'ap-east-1'
217
		| 'ap-south-1'
218
		| 'ap-northeast-2'
219
		| 'ap-southeast-1'
220
		| 'ap-southeast-2'
221
		| 'ap-northeast-1'
222
		| 'ca-central-1'
223
		| 'cn-north-1'
224
		| 'cn-northwest-1'
225
		| 'eu-central-1'
226
		| 'eu-west-1'
227
		| 'eu-west-2'
228
		| 'eu-west-3'
229
		| 'eu-north-1'
230
		| 'sa-east-1'
231
		| 'us-gov-east-1'
232
		| 'us-gov-west-1'
233
	/**
234
	 * The [AWS Access Key](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html#access-keys-and-secret-access-keys).Required for S3 sources, invalid for all others.
235
	 */
236
	access_key?: string
237
	/**
238
	 * The [AWS Secret Access Key](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html#access-keys-and-secret-access-keys).Required for S3 sources, invalid for all others.
239
	 */
240
	secret_key?: string
241
	/**
242
	 * The GCS or [S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html) prefix. Optional for GCS and S3 sourcse, invalid for HTTP.
243
	 */
244
	prefix?: string
245
	/**
246
	 * The GCS email address for authentication. Required for GCS sources, invalid for all others.
247
	 */
248
	client_email?: string
249
	/**
250
	 * The GCS private key. Required for GCS sources if not using impersonated tokens. Invalid for all others.
251
	 */
252
	private_key?: string
253
	[k: string]: unknown
254
}
255