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

# Auto-Approve Affiliate to Campaigns

export const MethodTag = ({method = "GET", path, label, colors = {}}) => {
  const presets = {
    get: {
      label: "GET",
      light: {
        bg: "#DCFCE7",
        text: "#15803D"
      },
      dark: {
        bg: "rgba(34,197,94,0.16)",
        text: "#4ADE80"
      }
    },
    post: {
      label: "POST",
      light: {
        bg: "#DBEAFE",
        text: "#1D4ED8"
      },
      dark: {
        bg: "rgba(59,130,246,0.16)",
        text: "#60A5FA"
      }
    },
    put: {
      label: "PUT",
      light: {
        bg: "#FEF3C7",
        text: "#B45309"
      },
      dark: {
        bg: "rgba(245,158,11,0.16)",
        text: "#FBBF24"
      }
    },
    patch: {
      label: "PATCH",
      light: {
        bg: "#F3E8FF",
        text: "#7E22CE"
      },
      dark: {
        bg: "rgba(168,85,247,0.16)",
        text: "#C084FC"
      }
    },
    delete: {
      label: "DEL",
      light: {
        bg: "#FEE2E2",
        text: "#B91C1C"
      },
      dark: {
        bg: "rgba(239,68,68,0.16)",
        text: "#F87171"
      }
    }
  };
  const fallback = {
    label: String(method).toUpperCase(),
    light: {
      bg: "#F3F4F6",
      text: "#374151"
    },
    dark: {
      bg: "rgba(156,163,175,0.16)",
      text: "#D1D5DB"
    }
  };
  const preset = presets[String(method).toLowerCase()] || fallback;
  const light = {
    ...preset.light,
    ...colors.light || ({})
  };
  const dark = {
    ...preset.dark,
    ...colors.dark || ({})
  };
  const css = `
    .invoca-method-tag {
      display: inline-block;
      padding: 1px 8px;
      margin-right: 8px;
      border-radius: 8px;
      font-size: 10px;
      line-height: 18px;
      font-weight: 700;
      letter-spacing: 0.4px;
      text-transform: uppercase;
      vertical-align: middle;
      background: var(--imt-bg);
      color: var(--imt-fg);
    }
    .invoca-method-path {
      font-size: 13px;
    }
    [data-component-part="accordion-icon"]:has(.invoca-method-tag) {
      width: auto;
      height: auto;
      flex-shrink: 0;
    }
    [data-component-part="accordion-icon"] .invoca-method-tag {
      margin-right: 0;
    }
    [data-component-part="accordion-button"]:has(.invoca-method-tag) {
      flex-wrap: wrap;
      row-gap: 6px;
    }
    [data-component-part="accordion-button"]:has(.invoca-method-tag) [data-component-part="accordion-icon"] {
      flex: 1 1 0;
      min-width: 0;
      overflow-wrap: anywhere;
    }
    [data-component-part="accordion-button"]:has(.invoca-method-tag) [data-component-part="accordion-title-container"] {
      flex: 0 0 calc(100% - 8px);
      padding-left: 20px;
    }
    [data-component-part="accordion-button"]:has(.invoca-method-tag) [data-component-part="accordion-title"] {
      font-size: 12px;
    }
    .dark .invoca-method-tag,
    [data-theme="dark"] .invoca-method-tag {
      background: var(--imt-bg-dark);
      color: var(--imt-fg-dark);
    }
  `;
  const vars = {
    "--imt-bg": light.bg,
    "--imt-fg": light.text,
    "--imt-bg-dark": dark.bg,
    "--imt-fg-dark": dark.text
  };
  return <span>
      <style>{css}</style>
      <span className="invoca-method-tag" style={vars}>
        {label || preset.label}
      </span>
      {path ? <code className="invoca-method-path">{path}</code> : null}
    </span>;
};

Changes to the Relationship between Advertiser and Affiliate on the network platform are replicated to the Invoca platform using this API. The operations on Advertiser‐Affiliate Relationships are similar to Network, in that the interface is fully idempotent, and the create and update commands will act as “create or update”.

When setting the Relationship between an Advertiser and Affiliate to Approved, all current and future campaign applications made between the Affiliate and Advertiser will be auto-approved. If the Relationship is set to any status other than Approved, all current and future applications will be declined and any active affiliate campaigns will be suspended.

Relationship status is set individually but reading is available for one or all relationships for an advertiser.

Parameters for the relationships are shown below

<table className="parameters docutils align-default"><thead><tr className="row-odd"><th className="head"><p>Property</p></th><th className="head"><p>Type</p></th><th className="head"><p>Value</p></th></tr></thead><tbody><tr className="row-even"><td><p>affiliate\_id\_from\_network</p></td><td><p>string</p></td><td><p>The network id for the affiliate. (read only)</p></td></tr><tr className="row-odd"><td><p>status</p></td><td><p>One of: Pending, Approved, Suspended, Declined, Deactivated</p></td><td><p>Status of the advertiser ‐ affiliate relationship.</p></td></tr></tbody></table>

Endpoint:

`https://invoca.net/api/2019-05-01/<network_id>/advertisers/<advertiser_id_from_network>/affiliates/<affiliate_id_from_network>.json`

<AccordionGroup>
  <Accordion title="Get all Advertiser-Affiliate relationships" icon={<MethodTag method="get" path="/advertisers/<advertiser_id>/affiliates"/>}>
    #### Examples

    Read all relationships for advertiser id from network 1

    Endpoint:

    `https://invoca.net/api/2019-05-01/<network_id>/advertisers/1/affiliates.json`

    Format: application/json

    Response Code: 200

    Response Body:

    ```json theme={null}
    [
      {
        "status": "Approved",
        "affiliate_id_from_network": "222"
      },
      {
        "status": "Approved",
        "affiliate_id_from_network": "34518"
      }
    ]
    ```
  </Accordion>

  <Accordion title="Get an Advertiser-Affiliate relationship" icon={<MethodTag method="get" path="/advertisers/<advertiser_id>/affiliates/<affiliate_id>"/>}>
    #### Examples

    Read a single relationship

    Endpoint:

    `https://invoca.net/api/2019-05-01/<network_id>/advertisers/1/affiliates/222.json`

    Format: application/json

    Response Code: 200

    Response Body:

    ```json theme={null}
    {
      "status": "Approved",
      "affiliate_id_from_network": "222"
    }
    ```
  </Accordion>

  <Accordion title="Create an Advertiser-Affiliate relationship" icon={<MethodTag method="post" path="/advertisers/<advertiser_id>/affiliates/<affiliate_id>"/>}>
    #### Examples

    Create relationship between Advertiser id from network 1 and Affiliate id from network 222

    Endpoint:

    `https://invoca.net/api/2019-05-01/<network_id>/advertisers/1/affiliates/222.json`

    Format: application/json

    Request Body:

    ```json theme={null}
    {
      "status": "Approved"
    }
    ```

    Response Code: 201

    Response Body:

    ```json theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="Update an Advertiser-Affiliate relationship" icon={<MethodTag method="put" path="/advertisers/<advertiser_id>/affiliates/<affiliate_id>"/>}>
    #### Examples

    Update an Advertiser-Affiliate relationship with id from network 1 and Affiliate id from network 222

    Endpoint:

    `https://invoca.net/api/2019-05-01/<network_id>/advertisers/1/affiliates/222.json`

    Format: application/json

    Request Body:

    ```json theme={null}
    {
      "status": "Approved"
    }
    ```

    Response Code: 200

    Response Body:

    ```json theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="Delete an Advertiser-Affiliate relationship" icon={<MethodTag method="delete" path="/advertisers/<advertiser_id>/affiliates/<affiliate_id>"/>}>
    #### Examples

    Delete a relationship

    Endpoint:

    `https://invoca.net/api/2019-05-01/<network_id>/advertisers/1/affiliates/222.json`

    Response Code: 200
  </Accordion>
</AccordionGroup>
