Skill Tracer
Skills › Scientific Agent Skills › database-lookup › simbad.md

simbad.md

405 lines · skills/database-lookup/references/simbad.md at 5f2bc03

Open on GitHub
1# SIMBAD Astronomical Database (CDS Strasbourg)
2
3SIMBAD contains data on astronomical objects beyond the Solar System, including identifications, coordinates, photometry, proper motions, parallaxes, radial velocities, spectral types, and bibliographic references.
4

SIMBAD Astronomical Database (CDS Strasbourg)

SIMBAD contains data on astronomical objects beyond the Solar System, including identifications, coordinates, photometry, proper motions, parallaxes, radial velocities, spectral types, and bibliographic references.

Raw lines 1 to 4
5## Base URLs
6
7**TAP endpoint (recommended):**
8```
9https://simbad.cds.unistra.fr/simbad/sim-tap/sync
10```
12**Script interface:**
13```
14https://simbad.cds.unistra.fr/simbad/sim-script
15```
17**Simple query endpoints:**
18```
19https://simbad.cds.unistra.fr/simbad/sim-id
20https://simbad.cds.unistra.fr/simbad/sim-coo
21```

Base URLs

TAP endpoint (recommended):

https://simbad.cds.unistra.fr/simbad/sim-tap/sync

Script interface:

https://simbad.cds.unistra.fr/simbad/sim-script

Simple query endpoints:

https://simbad.cds.unistra.fr/simbad/sim-id
https://simbad.cds.unistra.fr/simbad/sim-coo
Raw lines 5 to 22
23## Authentication
25No API key required. All endpoints are public.

Authentication

No API key required. All endpoints are public.

Raw lines 23 to 26
27## Key Endpoints

Key Endpoints

Raw lines 27 to 28
29### 1. TAP Queries (ADQL — recommended for programmatic use)
31```
32POST /simbad/sim-tap/sync
33Content-Type: application/x-www-form-urlencoded
35Parameters:
36 REQUEST=doQuery
37 LANG=ADQL
38 QUERY=<adql query>
39 FORMAT=json|votable|csv|tsv
40 MAXREC=<max rows>
41```
43| Parameter | Type | Description |
44|-----------|--------|-------------|
45| `REQUEST` | string | `doQuery` |
46| `LANG` | string | `ADQL` |
47| `FORMAT` | string | `json`, `votable`, `csv`, `tsv`. |
48| `QUERY` | string | **Required.** ADQL query. |
49| `MAXREC` | int | Max rows returned. Always set to avoid downloading millions of rows. |
51**Example — look up object by name:**
52```
53https://simbad.cds.unistra.fr/simbad/sim-tap/sync?request=doQuery&lang=adql&format=json&query=SELECT basic.OID, ra, dec, main_id, otype FROM basic JOIN ident ON oid = ident.oidref WHERE id = 'M31'
54```
56**Example — cone search (objects within 5 arcmin of coordinates):**
57```
58https://simbad.cds.unistra.fr/simbad/sim-tap/sync?request=doQuery&lang=adql&format=json&query=SELECT TOP 50 main_id, ra, dec, otype FROM basic WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10.684, 41.269, 0.083)) = 1
59```
60Note: radius in CIRCLE is in degrees (5 arcmin = 0.083 deg).
62**Example — objects by type (e.g., all pulsars):**
63```
64https://simbad.cds.unistra.fr/simbad/sim-tap/sync?request=doQuery&lang=adql&format=json&query=SELECT TOP 100 main_id, ra, dec, otype FROM basic WHERE otype = 'Psr'
65```

1. TAP Queries (ADQL — recommended for programmatic use)

POST /simbad/sim-tap/sync
Content-Type: application/x-www-form-urlencoded

Parameters:
  REQUEST=doQuery
  LANG=ADQL
  QUERY=<adql query>
  FORMAT=json|votable|csv|tsv
  MAXREC=<max rows>
ParameterTypeDescription
REQUESTstringdoQuery
LANGstringADQL
FORMATstringjson, votable, csv, tsv.
QUERYstringRequired. ADQL query.
MAXRECintMax rows returned. Always set to avoid downloading millions of rows.

Example — look up object by name:

https://simbad.cds.unistra.fr/simbad/sim-tap/sync?request=doQuery&lang=adql&format=json&query=SELECT basic.OID, ra, dec, main_id, otype FROM basic JOIN ident ON oid = ident.oidref WHERE id = 'M31'

Example — cone search (objects within 5 arcmin of coordinates):

https://simbad.cds.unistra.fr/simbad/sim-tap/sync?request=doQuery&lang=adql&format=json&query=SELECT TOP 50 main_id, ra, dec, otype FROM basic WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10.684, 41.269, 0.083)) = 1

Note: radius in CIRCLE is in degrees (5 arcmin = 0.083 deg).

Example — objects by type (e.g., all pulsars):

https://simbad.cds.unistra.fr/simbad/sim-tap/sync?request=doQuery&lang=adql&format=json&query=SELECT TOP 100 main_id, ra, dec, otype FROM basic WHERE otype = 'Psr'
Raw lines 29 to 66
67### 2. Identifier Query (simple lookup)
69```
70GET /simbad/sim-id?Ident={name}&output.format=votable
71```
73| Parameter | Type | Description |
74|------------------|--------|-------------|
75| `Ident` | string | **Required.** Object name (e.g., `M31`, `Sirius`, `NGC 1275`). |
76| `output.format` | string | `votable`, `html`. |

2. Identifier Query (simple lookup)

GET /simbad/sim-id?Ident={name}&output.format=votable
ParameterTypeDescription
IdentstringRequired. Object name (e.g., M31, Sirius, NGC 1275).
output.formatstringvotable, html.
Raw lines 67 to 77
78### 3. Coordinate Query
80```
81GET /simbad/sim-coo?Coord={coords}&Radius={radius}&Radius.unit={unit}&output.format=votable
82```
84| Parameter | Type | Description |
85|----------------|--------|-------------|
86| `Coord` | string | **Required.** Coordinates, e.g., `10.684 +41.269` or `00 42 44 +41 16 09`. |
87| `Radius` | float | Search radius. Default: 2. |
88| `Radius.unit` | string | `arcmin`, `arcsec`, `deg`. Default: `arcmin`. |
89| `output.format`| string | `votable`, `html`. |

3. Coordinate Query

GET /simbad/sim-coo?Coord={coords}&Radius={radius}&Radius.unit={unit}&output.format=votable
ParameterTypeDescription
CoordstringRequired. Coordinates, e.g., 10.684 +41.269 or 00 42 44 +41 16 09.
RadiusfloatSearch radius. Default: 2.
Radius.unitstringarcmin, arcsec, deg. Default: arcmin.
output.formatstringvotable, html.
Raw lines 78 to 90
91### 4. Script Interface (for multi-command queries)
93```
94POST /simbad/sim-script
95Content-Type: application/x-www-form-urlencoded
97Body: script=<script text>
98```
100A script consists of configuration lines followed by query commands:
102```
103output console=off script=off
104format object "<format string>"
105query id <object name>
106```
108**Query commands:**
109- `query id <name>` — lookup by name (e.g., `query id M31`)
110- `query coo <ra> <dec> radius=<value><unit>` — cone search (units: `d`=deg, `m`=arcmin, `s`=arcsec)
111- `query id wildcard <pattern>` — wildcard search (e.g., `query id wildcard NGC 10*`)
112- `query sample <criteria>` — criteria search (e.g., `query sample otype='*' & Vmag < 5.0`)
114**Multi-object queries** — include multiple `query id` lines in a single script:
115```
116output console=off script=off
117format object "%IDLIST(1) | %COO(s;A D;ICRS) | %OTYPE"
118query id M31
119query id M42
120query id M101
121```

4. Script Interface (for multi-command queries)

POST /simbad/sim-script
Content-Type: application/x-www-form-urlencoded

Body: script=<script text>

A script consists of configuration lines followed by query commands:

output console=off script=off
format object "<format string>"
query id <object name>

Query commands:

  • query id <name> — lookup by name (e.g., query id M31)
  • query coo <ra> <dec> radius=<value><unit> — cone search (units: d=deg, m=arcmin, s=arcsec)
  • query id wildcard <pattern> — wildcard search (e.g., query id wildcard NGC 10*)
  • query sample <criteria> — criteria search (e.g., query sample otype='*' & Vmag < 5.0)

Multi-object queries — include multiple query id lines in a single script:

output console=off script=off
format object "%IDLIST(1) | %COO(s;A D;ICRS) | %OTYPE"
query id M31
query id M42
query id M101
Raw lines 91 to 122
123## Script Format Codes
125Format codes define which fields appear in script output. Use inside `format object "..."`.

Script Format Codes

Format codes define which fields appear in script output. Use inside format object "...".

Raw lines 123 to 126
127### Identification
129| Code | Description | Example Output |
130|------|-------------|----------------|
131| `%IDLIST(1)` | Primary identifier | `M 31` |
132| `%IDLIST` | All identifiers | `M 31, NGC 224, UGC 454, ...` |
133| `%MAIN_ID` | Main identifier | `M 31` |

Identification

CodeDescriptionExample Output
%IDLIST(1)Primary identifierM 31
%IDLISTAll identifiersM 31, NGC 224, UGC 454, ...
%MAIN_IDMain identifierM 31
Raw lines 127 to 134
135### Coordinates
137| Code | Description | Example Output |
138|------|-------------|----------------|
139| `%COO(s;A D;ICRS)` | RA Dec ICRS (sexagesimal) | `00 42 44.330 +41 16 07.50` |
140| `%COO(d;A D;ICRS)` | RA Dec decimal degrees | `10.6847083 +41.2687500` |
141| `%COO(d;A D;GAL)` | Galactic coordinates | `121.1743 -21.5733` |

Coordinates

CodeDescriptionExample Output
%COO(s;A D;ICRS)RA Dec ICRS (sexagesimal)00 42 44.330 +41 16 07.50
%COO(d;A D;ICRS)RA Dec decimal degrees10.6847083 +41.2687500
%COO(d;A D;GAL)Galactic coordinates121.1743 -21.5733
Raw lines 135 to 142
143### Object Properties
145| Code | Description | Example Output |
146|------|-------------|----------------|
147| `%OTYPE` | Object type (short code) | `G` |
148| `%SP` | Spectral type | `A1V` |
149| `%MT` | Morphological type | `SA(s)b` |

Object Properties

CodeDescriptionExample Output
%OTYPEObject type (short code)G
%SPSpectral typeA1V
%MTMorphological typeSA(s)b
Raw lines 143 to 150
151### Photometry
153| Code | Description |
154|------|-------------|
155| `%FLUXLIST(V)` | V-band magnitude |
156| `%FLUXLIST(B)` | B-band magnitude |
157| `%FLUXLIST(U,B,V,R,I)` | Multiple bands |
158| `%FLUXLIST(J,H,K)` | Near-infrared bands |

Photometry

CodeDescription
%FLUXLIST(V)V-band magnitude
%FLUXLIST(B)B-band magnitude
%FLUXLIST(U,B,V,R,I)Multiple bands
%FLUXLIST(J,H,K)Near-infrared bands
Raw lines 151 to 159
160### Kinematics
162| Code | Description |
163|------|-------------|
164| `%PM` | Proper motion (mas/yr) |
165| `%PLX` | Parallax (mas) |
166| `%RV` | Radial velocity (km/s) |

Kinematics

CodeDescription
%PMProper motion (mas/yr)
%PLXParallax (mas)
%RVRadial velocity (km/s)
Raw lines 160 to 167
168### Predefined Format Levels
170```
171Basic: "%IDLIST(1) | %COO(s;A D;ICRS) | %OTYPE"
172Detailed: "%IDLIST(1) | %COO(s;A D;ICRS) | %OTYPE | %SP | %FLUXLIST(V)"
173Full: "%IDLIST(1) | %COO(s;A D;ICRS;J2000) | %OTYPE | %SP | %FLUXLIST(U,B,V,R,I,J,H,K) | %PM | %PLX | %RV | %MT"
174```

Predefined Format Levels

Basic:    "%IDLIST(1) | %COO(s;A D;ICRS) | %OTYPE"
Detailed: "%IDLIST(1) | %COO(s;A D;ICRS) | %OTYPE | %SP | %FLUXLIST(V)"
Full:     "%IDLIST(1) | %COO(s;A D;ICRS;J2000) | %OTYPE | %SP | %FLUXLIST(U,B,V,R,I,J,H,K) | %PM | %PLX | %RV | %MT"
Raw lines 168 to 175
176## Key TAP Tables

Key TAP Tables

Raw lines 176 to 177
178### `basic` — Main Object Table
180| Column | Type | Description |
181|--------|------|-------------|
182| `oid` | BIGINT | Internal object identifier (primary key) |
183| `main_id` | VARCHAR | Primary object identifier |
184| `ra` | DOUBLE | Right Ascension in degrees (ICRS) |
185| `dec` | DOUBLE | Declination in degrees (ICRS) |
186| `otype` | VARCHAR | Condensed object type code |
187| `sp_type` | VARCHAR | Spectral type |
188| `plx_value` | DOUBLE | Parallax in milliarcseconds |
189| `plx_err` | DOUBLE | Parallax error |
190| `pmra` | DOUBLE | Proper motion in RA (mas/yr) |
191| `pmdec` | DOUBLE | Proper motion in Dec (mas/yr) |
192| `rvz_radvel` | DOUBLE | Radial velocity (km/s) |
193| `rvz_err` | DOUBLE | Radial velocity error |
194| `galdim_majaxis` | DOUBLE | Galaxy major axis (arcmin) |
195| `galdim_minaxis` | DOUBLE | Galaxy minor axis (arcmin) |
196| `galdim_angle` | DOUBLE | Galaxy position angle (degrees) |

basic — Main Object Table

ColumnTypeDescription
oidBIGINTInternal object identifier (primary key)
main_idVARCHARPrimary object identifier
raDOUBLERight Ascension in degrees (ICRS)
decDOUBLEDeclination in degrees (ICRS)
otypeVARCHARCondensed object type code
sp_typeVARCHARSpectral type
plx_valueDOUBLEParallax in milliarcseconds
plx_errDOUBLEParallax error
pmraDOUBLEProper motion in RA (mas/yr)
pmdecDOUBLEProper motion in Dec (mas/yr)
rvz_radvelDOUBLERadial velocity (km/s)
rvz_errDOUBLERadial velocity error
galdim_majaxisDOUBLEGalaxy major axis (arcmin)
galdim_minaxisDOUBLEGalaxy minor axis (arcmin)
galdim_angleDOUBLEGalaxy position angle (degrees)
Raw lines 178 to 197
198### `ident` — Identifier Table
200| Column | Type | Description |
201|--------|------|-------------|
202| `oidref` | BIGINT | Reference to `basic.oid` |
203| `id` | VARCHAR | Identifier string |

ident — Identifier Table

ColumnTypeDescription
oidrefBIGINTReference to basic.oid
idVARCHARIdentifier string
Raw lines 198 to 204
205### `flux` — Photometric Measurements
207| Column | Type | Description |
208|--------|------|-------------|
209| `oidref` | BIGINT | Reference to `basic.oid` |
210| `filter` | VARCHAR | Filter name (U, B, V, R, I, J, H, K, u, g, r, i, z, G, etc.) |
211| `flux` | DOUBLE | Magnitude value |
212| `flux_err` | DOUBLE | Magnitude error |
213| `bibcode` | VARCHAR | Source reference bibcode |

flux — Photometric Measurements

ColumnTypeDescription
oidrefBIGINTReference to basic.oid
filterVARCHARFilter name (U, B, V, R, I, J, H, K, u, g, r, i, z, G, etc.)
fluxDOUBLEMagnitude value
flux_errDOUBLEMagnitude error
bibcodeVARCHARSource reference bibcode
Raw lines 205 to 214
215### `mesDistance` — Distance Measurements
217| Column | Type | Description |
218|--------|------|-------------|
219| `oidref` | BIGINT | Reference to `basic.oid` |
220| `dist` | DOUBLE | Distance value |
221| `unit` | VARCHAR | Distance unit (pc, kpc, Mpc) |
222| `minus_err` | DOUBLE | Lower error |
223| `plus_err` | DOUBLE | Upper error |
224| `method` | VARCHAR | Measurement method |
225| `bibcode` | VARCHAR | Source reference |

mesDistance — Distance Measurements

ColumnTypeDescription
oidrefBIGINTReference to basic.oid
distDOUBLEDistance value
unitVARCHARDistance unit (pc, kpc, Mpc)
minus_errDOUBLELower error
plus_errDOUBLEUpper error
methodVARCHARMeasurement method
bibcodeVARCHARSource reference
Raw lines 215 to 226
227### `has_ref` / `ref` — Bibliographic References
229`has_ref` links objects to references (`oidref` → `basic.oid`, `oidbibref` → `ref.oidbib`).
231| `ref` Column | Type | Description |
232|--------|------|-------------|
233| `oidbib` | BIGINT | Bibliography object ID |
234| `bibcode` | VARCHAR | ADS bibcode |
235| `title` | VARCHAR | Paper title |
236| `journal` | VARCHAR | Journal name |
237| `"year"` | INTEGER | Publication year |

has_ref / ref — Bibliographic References

has_ref links objects to references (oidref → basic.oid, oidbibref → ref.oidbib).

ref ColumnTypeDescription
oidbibBIGINTBibliography object ID
bibcodeVARCHARADS bibcode
titleVARCHARPaper title
journalVARCHARJournal name
"year"INTEGERPublication year
Raw lines 227 to 238
239### `otypedef` — Object Type Definitions
241| Column | Type | Description |
242|--------|------|-------------|
243| `otype` | VARCHAR | Object type code |
244| `description` | VARCHAR | Human-readable description |

otypedef — Object Type Definitions

ColumnTypeDescription
otypeVARCHARObject type code
descriptionVARCHARHuman-readable description
Raw lines 239 to 245
246## Common Object Types (otype)
248| Code | Description |
249|------|-------------|
250| `*` | Star |
251| `HII` | HII region |
252| `PN` | Planetary nebula |
253| `SNR` | Supernova remnant |
254| `G` | Galaxy |
255| `AGN` | Active galactic nucleus |
256| `QSO` | Quasar |
257| `ClG` | Galaxy cluster |
258| `GlC` | Globular cluster |
259| `OpC` | Open cluster |
260| `Psr` | Pulsar |
261| `WD*` | White dwarf |
262| `Pl` | Extra-solar planet |
263| `**` | Double/multiple star |
264| `V*` | Variable star |
265| `X` | X-ray source |
267Query `SELECT * FROM otypedef ORDER BY otype` for the full list. `otype` is the stored short code; `label` contains display labels such as `Galaxy`. Equality to `*` selects only that exact type, not every stellar subtype; use the type hierarchy deliberately when including descendants.

Common Object Types (otype)

CodeDescription
*Star
HIIHII region
PNPlanetary nebula
SNRSupernova remnant
GGalaxy
AGNActive galactic nucleus
QSOQuasar
ClGGalaxy cluster
GlCGlobular cluster
OpCOpen cluster
PsrPulsar
WD*White dwarf
PlExtra-solar planet
**Double/multiple star
V*Variable star
XX-ray source

Query SELECT * FROM otypedef ORDER BY otype for the full list. otype is the stored short code; label contains display labels such as Galaxy. Equality to * selects only that exact type, not every stellar subtype; use the type hierarchy deliberately when including descendants.

Raw lines 246 to 268
269## ADQL Query Patterns

ADQL Query Patterns

Raw lines 269 to 270
271### Spatial Queries
273**Cone search** — objects within a radius of a point:
274```sql
275SELECT main_id, ra, dec, otype
276FROM basic
277WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 83.633, 22.014, 0.5)) = 1
278```
279Parameters: `CIRCLE('ICRS', center_ra_deg, center_dec_deg, radius_deg)`
281**Box search:**
282```sql
283SELECT main_id, ra, dec, otype
284FROM basic
285WHERE CONTAINS(POINT('ICRS', ra, dec), BOX('ICRS', 180.0, 0.0, 10.0, 5.0)) = 1
286```
287Parameters: `BOX('ICRS', center_ra, center_dec, width_deg, height_deg)`
289**Polygon search:**
290```sql
291SELECT main_id, ra, dec
292FROM basic
293WHERE CONTAINS(POINT('ICRS', ra, dec), POLYGON('ICRS', 10.0, 40.0, 12.0, 40.0, 12.0, 42.0, 10.0, 42.0)) = 1
294```
296**Angular distance:**
297```sql
298SELECT main_id, ra, dec,
299 DISTANCE(POINT('ICRS', ra, dec), POINT('ICRS', 10.68458, 41.26917)) AS dist_deg
300FROM basic
301WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10.68458, 41.26917, 0.1)) = 1
302ORDER BY dist_deg ASC
303```

Spatial Queries

Cone search — objects within a radius of a point:

SELECT main_id, ra, dec, otype
FROM basic
WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 83.633, 22.014, 0.5)) = 1

Parameters: CIRCLE('ICRS', center_ra_deg, center_dec_deg, radius_deg)

Box search:

SELECT main_id, ra, dec, otype
FROM basic
WHERE CONTAINS(POINT('ICRS', ra, dec), BOX('ICRS', 180.0, 0.0, 10.0, 5.0)) = 1

Parameters: BOX('ICRS', center_ra, center_dec, width_deg, height_deg)

Polygon search:

SELECT main_id, ra, dec
FROM basic
WHERE CONTAINS(POINT('ICRS', ra, dec), POLYGON('ICRS', 10.0, 40.0, 12.0, 40.0, 12.0, 42.0, 10.0, 42.0)) = 1

Angular distance:

SELECT main_id, ra, dec,
       DISTANCE(POINT('ICRS', ra, dec), POINT('ICRS', 10.68458, 41.26917)) AS dist_deg
FROM basic
WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10.68458, 41.26917, 0.1)) = 1
ORDER BY dist_deg ASC
Raw lines 271 to 304
305### JOINs
307```sql
308-- V-band magnitudes
309SELECT b.main_id, b.ra, b.dec, f.flux AS Vmag
310FROM basic AS b
311JOIN flux AS f ON b.oid = f.oidref
312WHERE f.filter = 'V' AND f.flux < 6.0
313ORDER BY f.flux ASC
315-- All identifiers for an object
316SELECT b.main_id, i.id
317FROM basic AS b
318JOIN ident AS i ON b.oid = i.oidref
319WHERE b.main_id = 'M 31'
321-- Distance measurements
322SELECT b.main_id, d.dist, d.unit, d.method
323FROM basic AS b
324JOIN mesDistance AS d ON b.oid = d.oidref
325WHERE b.main_id = 'M 31'
326```

JOINs

-- V-band magnitudes
SELECT b.main_id, b.ra, b.dec, f.flux AS Vmag
FROM basic AS b
JOIN flux AS f ON b.oid = f.oidref
WHERE f.filter = 'V' AND f.flux < 6.0
ORDER BY f.flux ASC

-- All identifiers for an object
SELECT b.main_id, i.id
FROM basic AS b
JOIN ident AS i ON b.oid = i.oidref
WHERE b.main_id = 'M  31'

-- Distance measurements
SELECT b.main_id, d.dist, d.unit, d.method
FROM basic AS b
JOIN mesDistance AS d ON b.oid = d.oidref
WHERE b.main_id = 'M  31'
Raw lines 305 to 327
328### Cross-Matching Identifiers Between Catalogs
330```sql
331SELECT b.main_id, i1.id AS hipparcos_id, i2.id AS gaia_id
332FROM basic AS b
333JOIN ident AS i1 ON b.oid = i1.oidref AND i1.id LIKE 'HIP %'
334JOIN ident AS i2 ON b.oid = i2.oidref AND i2.id LIKE 'Gaia DR3%'
335WHERE b.otype = '*' AND b.plx_value > 50
336```

Cross-Matching Identifiers Between Catalogs

SELECT b.main_id, i1.id AS hipparcos_id, i2.id AS gaia_id
FROM basic AS b
JOIN ident AS i1 ON b.oid = i1.oidref AND i1.id LIKE 'HIP %'
JOIN ident AS i2 ON b.oid = i2.oidref AND i2.id LIKE 'Gaia DR3%'
WHERE b.otype = '*' AND b.plx_value > 50
Raw lines 328 to 337
338### Bibliography for Objects in a Region
340```sql
341SELECT b.main_id, r.bibcode, r.title, r."year"
342FROM basic AS b
343JOIN has_ref AS hr ON b.oid = hr.oidref
344JOIN ref AS r ON hr.oidbibref = r.oidbib
345WHERE CONTAINS(POINT('ICRS', b.ra, b.dec), CIRCLE('ICRS', 83.633, -5.375, 0.5)) = 1
346 AND r."year" >= 2020
347ORDER BY r."year" DESC
348```

Bibliography for Objects in a Region

SELECT b.main_id, r.bibcode, r.title, r."year"
FROM basic AS b
JOIN has_ref AS hr ON b.oid = hr.oidref
JOIN ref AS r ON hr.oidbibref = r.oidbib
WHERE CONTAINS(POINT('ICRS', b.ra, b.dec), CIRCLE('ICRS', 83.633, -5.375, 0.5)) = 1
  AND r."year" >= 2020
ORDER BY r."year" DESC
Raw lines 338 to 349
350### Aggregation
352```sql
353-- Count objects by type in a region
354SELECT otype, COUNT(*) AS count
355FROM basic
356WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 266.417, -29.008, 1.0)) = 1
357GROUP BY otype
358HAVING COUNT(*) > 5
359ORDER BY count DESC
361-- Average parallax grouped by the exact spectral-type string
362SELECT sp_type, AVG(plx_value) AS mean_plx, COUNT(*) AS n
363FROM basic
364WHERE sp_type IS NOT NULL AND plx_value IS NOT NULL
365GROUP BY sp_type
366ORDER BY sp_type
367```

Aggregation

-- Count objects by type in a region
SELECT otype, COUNT(*) AS count
FROM basic
WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 266.417, -29.008, 1.0)) = 1
GROUP BY otype
HAVING COUNT(*) > 5
ORDER BY count DESC

-- Average parallax grouped by the exact spectral-type string
SELECT sp_type, AVG(plx_value) AS mean_plx, COUNT(*) AS n
FROM basic
WHERE sp_type IS NOT NULL AND plx_value IS NOT NULL
GROUP BY sp_type
ORDER BY sp_type
Raw lines 350 to 368
369## Response Formats

Response Formats

Raw lines 369 to 370
371### TAP JSON
373```json
375 "metadata": [
376 {"name": "main_id", "datatype": "char"},
377 {"name": "ra", "datatype": "double"},
378 {"name": "dec", "datatype": "double"}
379 ],
380 "data": [
381 ["M 31", 10.6847, 41.2687]
382 ]
384```

TAP JSON

{
  "metadata": [
    {"name": "main_id", "datatype": "char"},
    {"name": "ra", "datatype": "double"},
    {"name": "dec", "datatype": "double"}
  ],
  "data": [
    ["M 31", 10.6847, 41.2687]
  ]
}
Raw lines 371 to 385
386### Script Response
388Plain text with pipe-delimited fields. Lines starting with `::` are metadata — filter them out. Check for `error` or `not found` in data lines to detect failures.

Script Response

Plain text with pipe-delimited fields. Lines starting with :: are metadata — filter them out. Check for error or not found in data lines to detect failures.

Raw lines 386 to 389
390## Rate Limits
392No formal rate limits documented. Best practices:
393- Add `time.sleep(0.5)` between sequential script queries
394- Use TAP/ADQL for batch queries instead of looping over the script interface
395- Always set `MAXREC` or use `TOP N` in TAP queries to avoid accidentally downloading millions of rows
396- Very large TAP queries may time out; tighten `WHERE` clauses or switch to async TAP at `/simbad/sim-tap/async`
397- Use VOTable format for large TAP results (preserves data types and units better than JSON)

Rate Limits

No formal rate limits documented. Best practices:

  • Add time.sleep(0.5) between sequential script queries
  • Use TAP/ADQL for batch queries instead of looping over the script interface
  • Always set MAXREC or use TOP N in TAP queries to avoid accidentally downloading millions of rows
  • Very large TAP queries may time out; tighten WHERE clauses or switch to async TAP at /simbad/sim-tap/async
  • Use VOTable format for large TAP results (preserves data types and units better than JSON)
Raw lines 390 to 398
399## Input Sanitization
401When building ADQL or script queries from user-supplied object names, sanitize inputs to prevent injection:
402- Reject control characters in object names. Use form/URL encoding for transport, and keep script commands and field names fixed
403- Escape single quotes in ADQL string literals by doubling them (`'` → `''`)
404- Limit input length (128 chars is reasonable)
405- Collapse and trim whitespace

Input Sanitization

When building ADQL or script queries from user-supplied object names, sanitize inputs to prevent injection:

  • Reject control characters in object names. Use form/URL encoding for transport, and keep script commands and field names fixed
  • Escape single quotes in ADQL string literals by doubling them (' → '')
  • Limit input length (128 chars is reasonable)
  • Collapse and trim whitespace
Raw lines 399 to 405