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

# Create an edge

> Creates a single typed edge from source to target. Edges are first-class — they carry their own id, properties, and audit trail; they are not embedded references on the item. Source and target must both exist in the caller's tenant.

Edge writes are **dual-gated**: the caller needs both write permission on the source item's type AND write permission on the edge type. Cardinalities and source/target type constraints are enforced at create time — violations return `400 edge_constraint_violation`. Cycles on `parent-of` and `supersedes` are rejected with `400 edge_cycle`. See [Permissions — dual-gate](/api/permissions#the-dual-gate-rule) and [Edges](/concepts/edges).



## OpenAPI

````yaml /openapi.json post /edges
openapi: 3.1.0
info:
  title: Marfa API
  version: 4.2.0
  description: Typed data layer for structured personal data
servers: []
security: []
paths:
  /edges:
    post:
      tags:
        - Edges
      summary: Create an edge
      description: >-
        Creates a single typed edge from source to target. Edges are first-class
        — they carry their own id, properties, and audit trail; they are not
        embedded references on the item. Source and target must both exist in
        the caller's tenant.


        Edge writes are **dual-gated**: the caller needs both write permission
        on the source item's type AND write permission on the edge type.
        Cardinalities and source/target type constraints are enforced at create
        time — violations return `400 edge_constraint_violation`. Cycles on
        `parent-of` and `supersedes` are rejected with `400 edge_cycle`. See
        [Permissions — dual-gate](/api/permissions#the-dual-gate-rule) and
        [Edges](/concepts/edges).
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                source_id:
                  type: string
                target_id:
                  type: string
                edge_type:
                  type: string
                properties:
                  type: object
                  additionalProperties:
                    nullable: true
              required:
                - source_id
                - target_id
                - edge_type
      responses:
        '201':
          description: Edge created
          content:
            application/json:
              schema:
                type: object
                properties:
                  edge:
                    type: object
                    properties:
                      id:
                        type: string
                      tenant_id:
                        type: string
                        nullable: true
                      source_id:
                        type: string
                      target_id:
                        type: string
                      edge_type:
                        type: string
                      properties:
                        type: object
                        additionalProperties:
                          nullable: true
                      created_at:
                        type: string
                      updated_at:
                        type: string
                    required:
                      - id
                      - source_id
                      - target_id
                      - edge_type
                      - properties
                      - created_at
                      - updated_at
                required:
                  - edge
        '400':
          description: Validation / constraint / cycle error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - missing_required_field
                          - invalid_id
                          - edge_constraint_violation
                          - edge_cycle
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - unauthorized
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '404':
          description: Source, target, or edge type not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - item_not_found
                          - edge_type_not_found
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key or OAuth Token
      description: Pass an API key (marfa_k1_...) or OAuth access token (marfa_at_...)

````