---
title: "Add Contact Channel"
full: true
_openapi:
  method: POST
  toc: []
  structuredData:
    headings: []
    contents:
      - content: "Creates a contact (if not exists) and enrolls them in a channel in one operation"
_apiData:
  document: "https://reloop.sh/api/contacts/openapi/json"
  operationData: [{"path":"/api/contacts/channel/{channel_id}","method":"post"}]
  parameterList: [{"name":"channel_id","type":"string","required":true,"description":"Channel ID","location":"path","example":"channel_123456789"},{"name":"contact_id","type":"string","required":false,"description":"Contact ID","location":"body"},{"name":"email","type":"string","required":false,"description":"Contact email address","location":"body","pattern":"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$"},{"name":"subscription","type":"\"opt_in\" | \"opt_out\"","required":false,"description":"","location":"body","enumValues":["opt_in","opt_out"]}]
  responseMap: {"201":{"description":"Response for status 201","schema":{"contact":{"object":"contact","id":"con_123456789","email":"john.doe@example.com","firstName":"John","lastName":"Doe","status":"subscribed","properties":{"company":"Reloop","role":"Developer"},"groups":[{"id":"grp_123456789","name":"Beta Testers"}],"channels":[{"id":"channel_123456789","name":"Newsletter","subscription":"opt_in"}],"suppressionReason":null,"suppressedAt":null,"createdAt":"2026-03-23T10:00:00.000Z","updatedAt":"2026-03-23T10:00:00.000Z","event":"evt_123456789"},"subscriptionId":"example_subscriptionId","event":"evt_123456789"}},"400":{"description":"Response for status 400","schema":{"message":"Invalid email format","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead."}},"403":{"description":"Response for status 403","schema":{"message":"Unauthorized access","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead."}},"404":{"description":"Response for status 404","schema":{"message":"Channel subscription not found","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead."}},"409":{"description":"Response for status 409","schema":{"message":"Contact is already subscribed to this channel","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead."}}}
  codeSamples:
    - id: node
      lang: javascript
      label: Node.js
      source: |-
        import { Reloop } from "reloop-email";
        
        const reloop = new Reloop({ apiKey: "rl_123456789" });
        
        const { channel, channelError } = await reloop.contacts.channels.addContact(
          "chn_123456789",
          { contact_id: "con_123456789", subscription: "opt_in" },
        );
        
        if (channelError) throw channelError;
        
        console.log(channel.subscriptionId, channel.contact.id);
    - id: curl
      lang: bash
      label: cURL
      source: |-
        curl -X POST https://reloop.sh/api/contacts/channel/chn_123456789 \
          -H "x-api-key: rl_123456789" \
          -H "Content-Type: application/json" \
          -d '{"contact_id": "con_123456789","subscription": "opt_in"}'
    - id: python
      lang: python
      label: Python
      source: |-
        from reloop_email import Reloop
        
        reloop = Reloop(api_key="rl_123456789")
        
        result = reloop.contacts.channels.addContact("chn_123456789", {
          "contact_id": "con_123456789",
          "subscription": "opt_in",
        })
        
        if result.channel_error:
            raise result.channel_error
        
        print(result.channel["subscriptionId"], result.channel["contact"].id)
    - id: php
      lang: php
      label: PHP
      source: |-
        <?php
        
        require 'vendor/autoload.php';
        
        use Reloop\Reloop;
        
        $reloop = Reloop::client('rl_123456789');
        
        $channel = $reloop->contacts->channels->addContact('chn_123456789', [
            'contact_id' => 'con_123456789',
            'subscription' => 'opt_in',
        ]);
        echo $channel['subscriptionId'] . ' ' . $channel['contact'].id . PHP_EOL;
    - id: java
      lang: java
      label: Java
      source: |-
        import sh.reloop.ReloopClient;
        ReloopClient reloop = new ReloopClient("rl_123456789");
        
        AddChannelContactParams params = new AddChannelContactParams();
        params.contactId = "con_123456789";
        params.subscription = "opt_in";
        var channel = reloop.contacts.channels.addContact("chn_123456789", params);
        System.out.println(channel.subscriptionId + " " + channel.contact.id);
    - id: dotnet
      lang: csharp
      label: .NET
      source: |-
        using Reloop;
        using Reloop.Models;
        
        var reloop = new ReloopClient("rl_123456789");
        
        await reloop.Contacts.Channels.AddContactAsync("chn_123456789", new Dictionary<string, object?> { ["contact_id"] = "con_123456789", ["subscription"] = "opt_in" });
    - id: go
      lang: go
      label: Go
      source: |-
        import reloop "github.com/reloop-labs/reloop-go"
        
        client, _ := reloop.NewClient(reloop.ClientOptions{
            APIKey: "rl_123456789",
        })
        
        _, _ = client.Contacts.Channels.AddContact("chn_123456789", map[string]interface{"contact_id": "con_123456789", "subscription": "opt_in"})
    - id: rust
      lang: rust
      label: Rust
      source: |-
        use reloop::ReloopClient;
        #[tokio::main]
        async fn main() -> Result<(), Box<dyn std::error::Error>> {
            let reloop = ReloopClient::new("rl_123456789".to_string(), None);
        
            reloop.contacts().channels().add_contact("chn_123456789", AddContactToChannelParams { contact_id: Some("con_123456789".to_string()), subscription: Some("opt_in".to_string()), ..Default::default() }).await?;
        
            Ok(())
        }
    - id: ruby
      lang: ruby
      label: Ruby
      source: |-
        require "reloop"
        
        reloop = Reloop::Client.new(api_key: "rl_123456789")
        
        reloop.contacts.channels.add_contact("chn_123456789", contact_id: "con_123456789", subscription: "opt_in")
    - id: elixir
      lang: elixir
      label: Elixir
      source: |-
        client = Reloop.client("rl_123456789")
        
        {:ok, result} = Reloop.Services.ContactChannels.add_contact(client, "chn_123456789", %{contact_id: "con_123456789", subscription: "opt_in"})
---
> For the complete documentation index, see [llms-docs.txt](/llms-docs.txt) or the site index [llms.txt](/llms.txt). Full docs corpus: [llms-full-docs.txt](/llms-full-docs.txt). Prefer markdown URLs (append `.md`) for agent consumption. Product skill: [skill.md](/skill.md).


{/* This file was generated by the OpenAPI doc generator. Do not edit this file directly. Run `bun run generate:api-docs` to regenerate. */}

<APIPage />
