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

# Advertising & Audiences

> Build verified, consent-based audience segments without third-party cookies. Advertisers buy access to cryptographically proven user attributes.

AIR Kit lets publishers issue verified audience credentials and configure programs that check audience eligibility using ZK proofs. Raw source records remain with the issuer. Encrypted credential payloads may be stored in DStorage, while users control decryption and disclosure to partners.

> [tab] For business
>
> ## The Problem
>
> Post-cookie advertising has a trust problem that no contextual or cohort-based replacement fully solves: someone still has to hold the raw user data and claim the audience is what they say it is. Data brokers vouch for segments they assembled from sources that are increasingly unverifiable. Advertisers pay for "35-44, high income, tech-interested" and get whatever the intermediary decided that means.
>
> ## What Changes With AIR Kit
>
> * **Users hold their own verified attributes** — Demographic and interest credentials are issued by your platform based on actual KYC and behaviour, not declared preferences. They're cryptographically signed
> * **Advertisers buy proof, not claims** — The DSP or SSP verifies the credential at serve time. They get COMPLIANT / NON\_COMPLIANT — a ZK proof that the user is 25–34, verified, consented, and located in AU. No raw data in the bid request
> * **Consent records are portable** — A credential can record consent collected by your CMP. Each publisher must still check that consent covers its purposes and recipients, and users control credential disclosure
> * **Age-restricted serving without storing DOB** — Prove `isOver18` at ad-serve time for gambling, alcohol, or adult categories. No DOB database to create or secure; confirm the setup meets your regulatory obligations
>
> ## How It Works
>
> **1. User completes profile or KYC on your platform**
>
> Your existing onboarding. The user verifies their age, confirms their country, or completes interest profiling. Nothing new for the user.
>
> **2. AIR Kit issues an audience credential**
>
> Your backend fires one API call. A credential encoding the user's age range, verified country, IAB interest segments, and consent record lands in their AIR Account.
>
> **3. Ad server verifies at serve time**
>
> When the user visits a publisher page, the publisher's ad server calls one SDK method. It receives a verified boolean signal: age verified, consent confirmed, segment matched.
>
> **4. DSP bids on verified signals**
>
> The bid request carries a verified audience flag. DSPs can bid higher on ZK-proven attributes than on unverified self-reported data. The audience segment is now worth more.
>
> ## What the Ad Server Actually Receives
>
> This example requests limited audience claims with user approval. The Verification Program determines the disclosed fields and whether a ZK proof is required.
>
> | What the Verifier Gets | What Stays Private |
> | - | - |
> | COMPLIANT / NON\_COMPLIANT | Date of birth, exact age |
> | Age range (`25-34`) | Full name, email address |
> | `isOver18: true` | IP address, device ID |
> | Country code (`AU`) | Precise location |
> | IAB segment IDs | Browsing history, clickstream |
> | Consent expiry | Declared interest details |
>
> ## What Compliance Will Ask
>
> **Does user consent need to be re-obtained?**
> The credential records consent collected by your CMP. A new publisher or purpose may require additional consent; a portable credential does not extend the scope of the original permission. Separately, users approve credential disclosure during verification.
>
> **Can users withdraw consent?**
> Users can withdraw consent through your consent-management process and deny future disclosure requests. Revoke the consent credential so subsequent checks reject it once the updated status is available. Revocation does not retract data already disclosed; apply withdrawal to the relevant downstream processing as well.
>
> **Does this replace our CMP?**
> No. Your CMP continues to collect and record consent. AIR Kit converts that consent record into a portable, cryptographically verifiable credential.
>
> ## Integration at a Glance
>
> | | |
> | - | - |
> | **What your team builds** | One API call in profile completion + one in your CMP callback |
> | **Engineering effort** | 1 backend engineer |
> | **Timeline to live** | 2–4 weeks |
> | **Partner publisher integration** | 3 lines of SDK code to verify |
>
> > [card] [Compliance FAQ](https://docs.air3.com/solutions/compliance-faq.md)
> >
> > Full GDPR, CCPA, and TCF answers.
>
> > [card] [Partner Economics](https://docs.air3.com/solutions/partner-economics.md)
> >
> > Revenue model, fee structure, and rewards.

> [tab] For developers
>
> ## What You Can Build
>
> * **Verified audience segments** — Issue demographic and interest credentials on profile completion or KYC; advertisers target against cryptographic proof, not self-reported fields
> * **Consent-portable targeting** — User consents once; that consent credential is verifiable by any publisher in the ecosystem without a consent management platform re-prompt
> * **Age-verified ad targeting** — Gate alcohol, gambling, and adult ad categories behind a ZK age proof — no DOB ever transmitted to the ad server
> * **Cross-publisher identity** — A user's verified attributes follow them across publisher sites without third-party cookies or device fingerprinting
> * **Bot and fraud resistance** — Issue a "verified human" credential after KYC or passkey authentication; DSPs and SSPs can filter on-credential instead of on-signal
> * **Brand safety compliance** — Verify user age and location at serve time without storing the data, supporting data-minimization requirements such as those in COPPA and GDPR Article 8. Whether a deployment complies depends on your implementation and jurisdiction
>
> ## Architecture
>
> ```mermaid theme={null}
> graph TD
>     A["User completes profile / KYC\non your platform"] --> B[Your Backend]
>     B -->| On-demand issuance| C[AIR Kit / Moca Chain]
>     C --> D["Audience Credentials\nin User's AIR Account"]
>
>     D --> E{Ad serve request}
>     E -->|Publisher verifies| F["ZK proof: age ✓ location ✓\ninterest segment ✓"]
>     F --> G[DSP receives verified segment signal]
>     G --> H[Targeted ad served]
>
>     D --> I{Cross-publisher visit}
>     I -->|Any partner publisher| J["Same credentials verified\nno cookie / fingerprint needed"]
> ```
>
> ## Recommended Schemas
>
> ### Verified Audience Segment
>
> ```json theme={null}
> {
>   "title": "Audience Segment",
>   "description": "Publisher-verified user audience attributes — no raw PII included",
>   "properties": {
>     "publisherId": {
>       "type": "string",
>       "description": "Issuing publisher identifier"
>     },
>     "ageRange": {
>       "type": "string",
>       "enum": ["18-24", "25-34", "35-44", "45-54", "55+"],
>       "description": "Verified age bracket — never the actual age or DOB"
>     },
>     "isOver18": {
>       "type": "boolean"
>     },
>     "isOver21": {
>       "type": "boolean"
>     },
>     "countryCode": {
>       "type": "string",
>       "description": "ISO 3166-1 alpha-2 — verified registration country"
>     },
>     "interestSegments": {
>       "type": "array",
>       "items": { "type": "string" },
>       "description": "IAB content categories — e.g. ['IAB19', 'IAB9'] — derived from behaviour, not declared"
>     },
>     "verifiedAt": {
>       "type": "string",
>       "format": "date-time"
>     }
>   },
>   "required": ["publisherId", "isOver18", "countryCode", "verifiedAt"]
> }
> ```
>
> ### Consent Credential
>
> ```json theme={null}
> {
>   "title": "Ad Consent",
>   "description": "Verifiable record of user consent for personalised advertising",
>   "properties": {
>     "publisherId": { "type": "string" },
>     "consentedTo": {
>       "type": "array",
>       "items": {
>         "type": "string",
>         "enum": ["personalised_ads", "cross_site_tracking", "interest_inference"]
>       }
>     },
>     "consentVersion": {
>       "type": "string",
>       "description": "CMP policy version the user consented to"
>     },
>     "consentedAt": {
>       "type": "string",
>       "format": "date-time"
>     },
>     "expiresAt": {
>       "type": "string",
>       "format": "date-time",
>       "description": "Consent expiry — re-issue when user re-confirms"
>     }
>   },
>   "required": ["publisherId", "consentedTo", "consentVersion", "consentedAt"]
> }
> ```
>
> > [!WARNING]
> >
> > Never include name, email address, IP address, device ID, or precise location in `credentialSubject`. Use only **derived, aggregated attributes** — `ageRange`, `countryCode`, `interestSegments`. The ZK proof lets the ad server confirm `isOver18 === true` without ever receiving the subscriber's date of birth.
>
> ## Implementation
>
> ### Step 1 — Issue audience credentials on profile completion
>
> ```javascript theme={null}
> // profile-complete-handler.js
> const { getPartnerJwt } = require('./lib/jwt');
> // issuer-controlled helpers backed by your signing keys
> const { buildVc, signVc, encryptToHolder } = require('./lib/credential');
>
> const AIR_API_ORIGIN = 'https://air.api.sandbox.air3.com';
> const BASE_URL = 'https://api.sandbox.mocachain.org/v1';
>
> // Resolve the recipient, then build, sign, encrypt, and store the credential in DStorage
> async function issueEncryptedCredential({ recipientEmail, schemaId, credentialSubject }) {
>   const token = await getPartnerJwt();
>
>   const init = await fetch(`${AIR_API_ORIGIN}/v2/auth/initialize-user`, {
>     method: 'POST',
>     headers: { 'Content-Type': 'application/json', 'x-partner-id': process.env.PARTNER_ID },
>     body: JSON.stringify({ partnerJwt: await getPartnerJwt({ email: recipientEmail }) }),
>   }).then((r) => r.json());
>
>   const vc = buildVc({ holderDid: init.did, cnf: init.signingKey, schemaId, credentialSubject });
>   const encrypted = encryptToHolder(signVc(vc), init.publicKey); // SD-JWT VC, encrypted to holder
>
>   const res = await fetch(`${BASE_URL}/dstorage/vcs`, {
>     method: 'POST',
>     headers: { 'Content-Type': 'application/json', 'x-partner-auth': token },
>     body: JSON.stringify({
>       holderDid: init.did,
>       proofType: 'SD_JWT_VC',
>       schemaId,
>       expiresAt: vc.expirationDate,
>       data: encrypted.encryptedData,
>       iv: encrypted.iv,
>       authTag: encrypted.authTag,
>       encryptedKey: encrypted.dataEncPublicKey,
>       externalId: vc.id,
>     }),
>   });
>   if (!res.ok) throw new Error(`Issuance failed: ${res.status}`);
>   return res.json(); // { storagePath }
> }
>
> async function issueAudienceCredential({ userEmail, profile }) {
>   return issueEncryptedCredential({
>     recipientEmail: userEmail,
>     schemaId: process.env.AUDIENCE_CREDENTIAL_ID,
>     credentialSubject: {
>       publisherId: process.env.PUBLISHER_ID,
>       ageRange: getAgeRange(profile.birthYear),    // "25-34" — NOT the DOB
>       isOver18: profile.age >= 18,
>       isOver21: profile.age >= 21,
>       countryCode: profile.countryCode,
>       interestSegments: profile.iabSegments,       // e.g. ['IAB19', 'IAB9-30']
>       verifiedAt: new Date().toISOString(),
>     },
>   });
> }
>
> function getAgeRange(birthYear) {
>   const age = new Date().getFullYear() - birthYear;
>   if (age < 25) return '18-24';
>   if (age < 35) return '25-34';
>   if (age < 45) return '35-44';
>   if (age < 55) return '45-54';
>   return '55+';
> }
>
> // Fire on profile completion and on interest segment updates
> userEvents.on('profile:completed', ({ userEmail, profile }) =>
>   issueAudienceCredential({ userEmail, profile })
> );
> userEvents.on('interests:updated', ({ userEmail, profile }) =>
>   issueAudienceCredential({ userEmail, profile })
> );
> ```
>
> ### Step 2 — Issue consent credential when user accepts CMP
>
> ```javascript theme={null}
> // consent-handler.js
> async function issueConsentCredential({ userEmail, consentRecord }) {
>   const expiresAt = new Date();
>   expiresAt.setFullYear(expiresAt.getFullYear() + 1); // 1-year consent window
>
>   await issueEncryptedCredential({
>     recipientEmail: userEmail,
>     schemaId: process.env.CONSENT_CREDENTIAL_ID,
>     credentialSubject: {
>       publisherId: process.env.PUBLISHER_ID,
>       consentedTo: consentRecord.purposes,       // ["personalised_ads", ...]
>       consentVersion: consentRecord.policyVersion,
>       consentedAt: new Date().toISOString(),
>       expiresAt: expiresAt.toISOString(),
>     },
>   });
> }
>
> // Wire into your CMP callback
> cmp.on('consent:granted', ({ userEmail, purposes, policyVersion }) =>
>   issueConsentCredential({
>     userEmail,
>     consentRecord: { purposes, policyVersion },
>   })
> );
>
> // Revoke consent credential on withdrawal
> cmp.on('consent:withdrawn', async ({ userEmail }) => {
>   // Issue credential with empty consentedTo to effectively invalidate
>   // Or call the revoke endpoint directly — see Issuance API Reference
> });
> ```
>
> ### Step 3 — Verify audience attributes at ad-serve time
>
> ```javascript theme={null}
> // ad-server-verify.js (publisher ad server / prebid adapter)
> import { AirService } from '@mocanetwork/airkit';
>
> import { AirService, BUILD_ENV } from "@mocanetwork/airkit";
>
> const airService = new AirService({ partnerId: process.env.PUBLISHER_PARTNER_ID });
> await airService.init({ buildEnv: BUILD_ENV.PRODUCTION });
>
> async function getVerifiedAudienceSignal() {
>   // Check age compliance for restricted category
>   const ageResult = await airService.verifyCredential({
>     programId: process.env.AGE_18_VERIFY_PROGRAM_ID,
>     // Program rule: isOver18 === true
>     // Use a ZK age check without requesting the user's date of birth.
>     // Successful results include a Verifiable Presentation.
>   });
>
>   // Check consent for personalised ads
>   const consentResult = await airService.verifyCredential({
>     programId: process.env.CONSENT_VERIFY_PROGRAM_ID,
>     // Program rule: "personalised_ads" in consentedTo AND expiresAt > now
>   });
>
>   return {
>     ageVerified: ageResult.status === 'COMPLIANT',
>     consentVerified: consentResult.status === 'COMPLIANT',
>     // Pass these as verified signals to your DSP bid request
>     // No raw age, no raw consent record — just provable booleans
>   };
> }
>
> // Enrich bid request with verified signals
> async function buildBidRequest(adSlot, user) {
>   const signals = await getVerifiedAudienceSignal();
>
>   return {
>     ...adSlot,
>     user: {
>       ...user,
>       ext: {
>         airkit: {
>           ageVerified: signals.ageVerified,
>           consentVerified: signals.consentVerified,
>           // DSP can bid higher on verified signals vs. unverified
>         },
>       },
>     },
>   };
> }
> ```
>
> ### Step 4 — Cross-publisher audience verification (partner publisher)
>
> Partner publishers integrate AIR Kit as a verifier. One SDK call replaces the cookie sync / data clean room round-trip.
>
> ```javascript theme={null}
> // partner-publisher.js
> import { AirService } from '@mocanetwork/airkit';
>
> // The PARTNER publisher uses their own Partner ID
> const airService = new AirService({ partnerId: 'PARTNER_PUBLISHER_PARTNER_ID' });
> await airService.init({ buildEnv: BUILD_ENV.PRODUCTION });
>
> async function verifyAudienceForPartner() {
>   const result = await airService.verifyCredential({
>     programId: process.env.CROSS_PUB_AUDIENCE_VERIFY_PROGRAM_ID,
>     // Program checks: isOver18 === true AND countryCode in allowed list
>     // The partner publisher never receives the user's raw profile data
>     // They get: COMPLIANT / NON_COMPLIANT — that's it
>   });
>   return result.status === 'COMPLIANT';
> }
> ```
>
> ## Key Patterns
>
> | Pattern | Reissue behavior | When to Use |
> | - | :-: | - |
> | Initial audience credential | Skip if exists | Issue once on first profile completion |
> | Interest segment refresh | Revoke + reissue | Monthly or on significant interest drift |
> | Consent granted | Revoke + reissue | Always replace with latest consent record |
> | Consent withdrawn | Revoke | Reject future checks once revoked status is available; apply withdrawal to downstream processing |
> | KYC-backed audience | Revoke + reissue | Re-issue when KYC result updates |
>
> ## Data disclosure
>
> For this audience check, request only the necessary claims and use ZK proofs for conditions that do not require disclosing their underlying values. Successful verification returns a Verifiable Presentation with user-approved claims and any required proof. Configure the program to exclude DOB, email, IP address, and browsing history; the table below describes that limited-disclosure example.
>
> | What the Verifier Sees | What Stays Private |
> | - | - |
> | `COMPLIANT / NON_COMPLIANT` | Date of birth, exact age |
> | `ageRange` (`25-34`) | Full name, email address |
> | `isOver18: true` | IP address, device ID |
> | `countryCode` (`AU`) | Precise location |
> | IAB segment IDs | Browsing history, clickstream |
> | Consent expiry date | Declared interests |
>
> ## Regulatory Alignment
>
> Credentials can record consent and support age or eligibility checks, but do not establish regulatory compliance on their own. Review the scope of consent, applicable age requirements, opt-out handling, and retention for each publisher and purpose. Your CMP remains responsible for collecting and managing consent. See the [Compliance FAQ](https://docs.air3.com/solutions/compliance-faq.md) for storage and disclosure considerations.
>
> ## Examples
>
> > [card] [Verified traffic (offline)](https://demo.air3.com/demo/verified-traffic-offline)
> >
> > Video walkthrough: a customer's airline status is verified at a partner restaurant.
>
> > [card] [Verified traffic (online)](https://publisher-poc.netlify.app/)
> >
> > Live publisher demo: a visitor signs in with AIR on a storefront and reaches a partner campaign already recognized.
>
> ## Next Steps
>
> > [card] [On-demand Issuance — Concepts](https://docs.air3.com/products/identity/issuing-credentials#direct-issuance)
> >
> > On-demand issuance without user presence.
>
> > [card] [On-demand Issuance — API](https://docs.air3.com/api-reference/issuance-api.md)
> >
> > Full endpoint reference with error codes.
>
> > [card] [AIR for Fintech & Payments](https://docs.air3.com/solutions/fintech.md)
> >
> > KYC portability and age verification patterns.
>
> > [card] [Register credential types](https://docs.air3.com/products/identity/schema-creation.md)
> >
> > Register the credential type your backend issues.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.