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

# TLE Generation

> Generate Two-Line Element sets from state vectors

> For the complete documentation index, see [llms.txt](https://docs.valar.space/llms.txt).

The spacecraft cheatsheet separates **Own computed** TLEs, fitted from your latest stored state vector, from **Public** catalogue data. Public orbital elements may be usable for propagation even when there are no TLE lines to copy.

## Accessing TLEs

1. Open the **cheatsheet** from the application header in **Operations**.
2. Select your spacecraft.
3. Open **Own computed** to view a fitted TLE, or **Public** to view available provider TLE text.
4. Use the copy button in that tab to copy the displayed two lines.

The source marked as in use identifies the orbit-source category currently driving products. It does not mean both tabs contain the same orbit.

## How It Works

| Aspect | Behavior |
| - | - |
| **State vector used for Own computed** | The latest eligible stored state by epoch: a manual/imported state or an accepted, converged orbit solution |
| **Fitted TLE epoch** | The cheatsheet requests the current time; VALAR propagates the state to that epoch before fitting |
| **Selection** | Selecting an older state vector elsewhere in the cheatsheet does not change the fitted-TLE request |
| **Refresh** | Opening the cheatsheet or changing spacecraft requests fresh own-computed data |
| **Public source** | Stored Space-Track or CelesTrak orbital data; optional TLE text retains its provider epoch |
| **Unsupported TLE identifier** | Above `339999`, the cheatsheet explains the limit and skips fitted-TLE generation; other orbital data can still load |

> [!NOTE]
>
> The fitted TLE's epoch is its output time, which can differ from the source state vector's epoch. The cheatsheet requests the current time; selecting an older state vector in its details does not select a different TLE epoch.

If **Own computed** has no TLE, import a state vector or run orbit determination to provide one. Public GP elements without text remain usable for supported public-orbit workflows; their presence alone does not provide an own-computed TLE.

## Export through the Operations API

Use [Generate a fitted TLE](https://docs.valar.space/api-reference/state-vectors/generate-a-fitted-tle.md) in the **State Vectors** API reference:

```http theme={null}
GET /operations/spacecraft/{spacecraftId}/tle?epoch=2026-09-22T12:00:00Z
```

> [!NOTE]
>
> This operation is available to customers with an authorized Operations API key. It requires the existing organization access and `read:ephemeris` permission; there is no separate internal-email or feature-rollout requirement.

### Authentication and inputs

Use an [Operations API key](https://docs.valar.space/features/api-keys.md) with access to the spacecraft's organization and the `read:ephemeris` permission. Send it as `Authorization: Bearer YOUR_API_KEY`.

| Input | Required | Meaning |
| - | - | - |
| `spacecraftId` (path) | Yes | The canonical spacecraft `id` returned by `GET /operations/spacecraft`. Do not supply a name, NORAD number or COSPAR identifier. |
| `epoch` (query) | Yes | The target epoch as an ISO-8601 instant with `Z` or an explicit timezone offset. There is no default epoch. |

Set `VALAR_API_KEY` to your key and `SPACECRAFT_ID` to the canonical ID, then run:

```bash theme={null}
curl --fail-with-body --get \
  "https://api.valar.space/operations/spacecraft/${SPACECRAFT_ID}/tle" \
  --header "Authorization: Bearer ${VALAR_API_KEY}" \
  --header "Accept: text/plain, application/json" \
  --data-urlencode "epoch=2026-09-22T12:00:00Z"
```

`--data-urlencode` also preserves the `+` in a positive timezone offset, such as `2026-09-22T14:00:00+02:00`.

### Result and prerequisites

A successful response is **200**, `Content-Type: text/plain`: exactly two TLE lines separated by a newline, with no name line or JSON wrapper. The response is marked `Cache-Control: no-store`. Generation is synchronous and does not save a new resource or start a background job.

The operation uses the existing **Own computed** generator: it selects the latest eligible stored state by epoch, propagates it to your requested epoch with the existing accurate force model and applicable maneuvers, then fits a single-state TLE. The request does not select a historical source state, accept raw state-vector input, or retrieve provider TLEs. It does not fall back to public catalogue data if an eligible stored state is missing.

The spacecraft needs an eligible stored state and the mass, drag, radiation-pressure and geometry configuration required by its force model. The [catalogue-number limits](#six-digit-catalog-numbers) apply. When no NORAD ID is assigned, the existing generator uses the `99999` placeholder; it is not an assigned catalogue identity. An assigned ID above the supported limit is rejected, never replaced with that placeholder or truncated.

The fitted TLE carries the requested output epoch, not necessarily the source state's epoch. This export makes no receiver-compatibility or orbit-accuracy guarantee.

### Failure responses

Request, generation and API-key rejection failures use structured `application/json` errors rather than TLE text. Authentication can reject missing credentials or a malformed bearer token before API-key handling with an empty **401** body and a `WWW-Authenticate: Bearer` header. Always inspect the HTTP status before parsing either an error or TLE text.

Success is `text/plain` only. If you set an `Accept` header, allow `text/plain` (for example, `text/plain, application/json` as above). An unsupported or malformed Accept header receives a structured JSON **406**, including when failure occurs before generation.

| Status | Meaning / next step |
| - | - |
| **400** | Missing or invalid epoch, invalid source state, missing force-model configuration, unsupported catalogue ID, or propagation failure. Correct the reported input or configuration. |
| **401** | Missing, invalid, expired or disabled API key. Check the key. |
| **403** | Insufficient key grant, IP allowlist, environment access or `read:ephemeris` permission. Check authorization. |
| **404** | Spacecraft is unknown or inaccessible (`SC-4040` with the supplied ID). Check the canonical ID from the spacecraft API; an all-zero UUID is not a spacecraft. |
| **406** | Unsupported or malformed Accept header. Allow `text/plain` for the TLE success response. |
| **422** | Existing spacecraft without eligible orbital state (`ORBITAL_STATE_NOT_FOUND`): upload ephemeris data or propagate from a TLE. Also returned for physically degenerate or numerically unrepresentable orbital input; review the source state. |
| **500** | Unexpected generation failure. Contact VALAR with the error details. |

## TLE Format

The generated TLE follows the standard NORAD two-line format:

```
1 NNNNNC NNNNNAAA NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNN
2 NNNNN NNN.NNNN NNN.NNNN NNNNNNN NNN.NNNN NNN.NNNN NN.NNNNNNNNNNNNNN
```

For details on the TLE format and field definitions, see the [TLE Format](https://docs.valar.space/file-formats/tle.md) documentation.

## Six-digit catalog numbers

VALAR continues fitting and generating TLEs from state vectors. Public catalogue orbits can be stored as GP mean elements without TLE text; that does not remove TLE generation.

* Catalog numbers through **99999** use the ordinary numeric TLE format.
* **100000–339999** use Alpha-5 in the exported TLE's five-character satellite-number field. Confirm your ground-station software supports Alpha-5 before using these files for antenna pointing.
* **340000–999999** cannot be represented in TLE/Alpha-5. The cheatsheet displays the format limit, and API TLE export rejects the request. Use an [OEM ephemeris](https://docs.valar.space/features/ephemeris-generation.md) if your receiver accepts it.

VALAR always keeps the full assigned numeric catalog number. Export never truncates it or substitutes a different satellite number. A spacecraft without an assigned NORAD ID retains the generator's `99999` placeholder.

## Related Pages

* [Generate a fitted TLE](https://docs.valar.space/api-reference/state-vectors/generate-a-fitted-tle.md): Operations API contract and request parameters
* [State Vectors](https://docs.valar.space/features/state-vectors.md): Manage orbit solutions and state vectors
* [TLE Format](https://docs.valar.space/file-formats/tle.md): TLE file format specification
* [Generate OEM](https://docs.valar.space/features/ephemeris-generation.md): Generate ephemeris files


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.