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

# Create Edge

> Add a new edge connecting two nodes

## Request

```bash theme={null}
POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges
```

### Path Parameters

<ParamField path="projectId" type="string" required>The project ID</ParamField>

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token using your developer key
</ParamField>

### Body

<ParamField body="id" type="string">
  Optional edge ID. Auto-generated if not provided.
</ParamField>

<ParamField body="source" type="string" required>
  Source node ID
</ParamField>

<ParamField body="target" type="string" required>
  Target node ID
</ParamField>

<ParamField body="condition" type="string" required>
  Transition condition (when should the conversation move from source to target)
</ParamField>

## Response

Returns the created edge with status `201`.

Returns `400` if the source or target node does not exist.

### Example

```bash theme={null}
curl -X POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "node-1",
    "target": "node-2",
    "condition": "User confirms the booking"
  }'
```

```json theme={null}
{
  "data": {
    "id": "edge-node-1-node-2-1709827200000",
    "source": "node-1",
    "target": "node-2",
    "data": { "condition": "User confirms the booking" }
  }
}
```
