# Connections

Source: https://swapcard.dev/analytics-api/export/actions/connection


Find the actions recorded when users connect, send connection requests or create contacts, and the fields each one returns.

Each action name below is a value of the `event` field in the [export response](../graphql-analytics-api-export.mdx#example-response). Pass it in the `events` filter to export only that action. **Body** lists the fields of the action's `body` object. Actions labelled **Has recipient** also return the `with_*` fields of the other user.

## Connections
<HttpParameters
title="Action"
params={[
  {
    "name": "connection_create",
    "type": "string",
    "label": "Has recipient",
    "description": "When a connection is created (one per user)."
  },
  {
    "name": "connection_update",
    "type": "string",
    "label": "Has recipient",
    "description": "When the connection rating is updated."
  },
]}
>
</HttpParameters>

<HttpParameters
title="Body"
params={[
  {
    "name": "rating",
    "type": "float",
    "label": "Nullable",
    "description": "Rating between 0 and 5.",
  },
  {
    "name": "scanned",
    "type": "bool",
    "description": "Whether the connection comes from a scan.",
  }
]}
>
</HttpParameters>

## Connection requests
<HttpParameters
title="Action"
params={[
  {
    "name": "connection_request_create",
    "type": "string",
    "label": "Has recipient",
    "description": "When the user sends a connection request to another user."
  },
  {
    "name": "connection_request_update",
    "type": "string",
    "label": "Has recipient",
    "description": "When the status of the connection request changes."
  }
]}
>
</HttpParameters>

<HttpParameters
title="Body"
params={[
  {
    "name": "status",
    "type": "string",
    "description": "One of ACCEPTED, DECLINED, PENDING."
  },
]}
>
</HttpParameters>

## Contacts
A contact is a connection with someone who isn't a Swapcard user.

<HttpParameters
title="Action"
params={[
  {
    "name": "contact_connection_create",
    "type": "string",
    "description": "When the user creates a contact with a non-user."
  },
]}
>
</HttpParameters>

<HttpParameters
title="Body"
params={[
  {
    "name": "with_contact_id",
    "type": "string",
    "description": "The ID of the contact created.",
  },
  {
    "name": "scanned",
    "type": "bool",
    "description": "Whether the connection comes from a scan.",
  }
]}
>
</HttpParameters>
