# Synastry & Compatibility API

Full set of endpoints for compatibility analysis — from classical synastry to group matrices of up to 10 people.

## What's calculated

- **Cross-aspects** — aspects between planets of two charts (Sun-Venus trine, Moon-Mars square, etc.)
- **Compatibility score** — 0–100 numeric score with label (harmonious, balanced, mixed, challenging)
- **Harmony/Tension** — weighted sums of harmonious and tense aspects
- **Composite chart** — midpoints between planets of two people
- **Davison chart** — chart for the mean date and coordinates
- **Group matrix** — pairwise compatibility for each pair (2–10 people)

## Endpoints

| Endpoint | Credits | What it returns |
|---|---|---|
| `/v1/synastry` | 50 | Cross-aspects + compatibility score |
| `/v1/composite` | 50 | Composite chart (midpoints) |
| `/v1/davison` | 50 | Davison chart (mean date) |
| `/v1/coalescent` | 50 | Coalescent chart |
| `/v1/group-synastry` | 100 | Compatibility matrix for 2–10 people |
| `/v1/human-design/compatibility` | 100 | HD compatibility |

## Example

<Tabs>
  <TabItem label="cURL">
    ```bash frame="terminal"
    curl -X POST https://api.astroway.info/v1/synastry \
      -H "X-Api-Key: aw_live_your_key_here" \
      -H "Content-Type: application/json" \
      -d '{
        "chart1": {
          "date": "1990-07-14", "time": "14:30:00",
          "timezoneOffset": 3, "latitude": 50.45, "longitude": 30.52
        },
        "chart2": {
          "date": "1992-03-22", "time": "09:15:00",
          "timezoneOffset": 2, "latitude": 48.85, "longitude": 2.35
        }
      }'
    ```
  </TabItem>
  <TabItem label="Node.js">
    ```ts
    const r = await fetch('https://api.astroway.info/v1/synastry', {
      method: 'POST',
      headers: {
        'X-Api-Key': process.env.ASTROWAY_API_KEY!,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        chart1: { date: '1990-07-14', time: '14:30:00', timezoneOffset: 3, latitude: 50.45, longitude: 30.52 },
        chart2: { date: '1992-03-22', time: '09:15:00', timezoneOffset: 2, latitude: 48.85, longitude: 2.35 },
      }),
    });
    const { data: result } = await r.json();

    console.log(`Score: ${result.compatibility.score}/100`);
    console.log(`Label: ${result.compatibility.label}`);
    ```
  </TabItem>
  <TabItem label="Python">
    ```python

    r = requests.post(
        'https://api.astroway.info/v1/synastry',
        headers={'X-Api-Key': os.environ['ASTROWAY_API_KEY'], 'Content-Type': 'application/json'},
        json={
            'chart1': {'date': '1990-07-14', 'time': '14:30:00', 'timezoneOffset': 3, 'latitude': 50.45, 'longitude': 30.52},
            'chart2': {'date': '1992-03-22', 'time': '09:15:00', 'timezoneOffset': 2, 'latitude': 48.85, 'longitude': 2.35},
        },
    )
    result = r.json()['data']
    print(f"Score: {result['compatibility']['score']}/100 ({result['compatibility']['label']})")
    ```
  </TabItem>
  <TabItem label="PHP">
    ```php
    <?php
    use GuzzleHttp\Client;

    $aw = new Client(['base_uri' => 'https://api.astroway.info/v1/']);
    $r = $aw->post('synastry', [
        'headers' => ['X-Api-Key' => getenv('ASTROWAY_API_KEY')],
        'json' => [
            'chart1' => ['date' => '1990-07-14', 'time' => '14:30:00', 'timezoneOffset' => 3, 'latitude' => 50.45, 'longitude' => 30.52],
            'chart2' => ['date' => '1992-03-22', 'time' => '09:15:00', 'timezoneOffset' => 2, 'latitude' => 48.85, 'longitude' => 2.35],
        ],
    ]);
    $result = json_decode($r->getBody(), true)['data'];
    echo "Score: {$result['compatibility']['score']}/100 ({$result['compatibility']['label']})\n";
    ```
  </TabItem>
</Tabs>

## Example response (compatibility)

```json
{
  "compatibility": {
    "score": 72,
    "label": "harmonious",
    "harmony": 18.5,
    "tension": 7.2
  }
}
```

## Use cases

### Dating apps

Call `/v1/synastry` on match — compatibility score as an additional ranking factor. Cache the result for the pair (immutable input = immutable output).

### Astrology apps

Full analysis: synastry + composite + Davison. Three requests — 150 credits, complete picture of a relationship.

### Team tools

`/v1/group-synastry` with 5 people — matrix of 10 pairs in a single request (100 credits instead of 500 separate ones).

## Pricing

Synastry — **50 credits**. On the Free tier — 200 synastries per month free.

<CardGrid>
  <LinkCard title="Detailed example →" href="/en/examples/synastry/" description="Parameters, response, cross-aspects" />
  <LinkCard title="Quick start" href="/en/getting-started/" description="First request in 5 minutes" />
  <LinkCard title="Pricing" href="/en/pricing/" description="From Free to Enterprise" />
</CardGrid>
