Mobile SDK

Ads in Your App.One API Call.

Integrate MagicAds into any iOS, Android, React Native, or Flutter app. Fetch ads as JSON, render them natively. Or just prompt your AI to do it.

Tell your AI coding assistant:

"Add MagicAds to my iOS app. Use the MagicAds SDK API at magicads.dev/api/sdk to show a banner ad on the home screen and an interstitial after level complete."

Works with Cursor, Copilot, Windsurf, Codex, or any AI that can write code.

JSON API

No SDK binary. Just a GET request. Render ads natively in your UI framework.

All Platforms

iOS, Android, React Native, Flutter, Unity — anything that can make HTTP requests.

Built-in Analytics

Pageviews, visitors, devices, geo, referrers — auto-tracked. View at /dashboard.

AI Prompt Setup

Tell your AI assistant to integrate MagicAds. It reads our API and writes the code.

Copy. Paste. Ship.

Swift (iOS)
import SwiftUI

struct MagicAdBanner: View {
    @State private var ad: MagicAd?

    var body: some View {
        Group {
            if let ad = ad {
                Link(destination: URL(string: ad.actions.clickUrl)!) {
                    VStack(spacing: 8) {
                        Text(ad.creative.headline)
                            .font(.headline).bold()
                            .foregroundColor(.white)
                        Text(ad.creative.cta)
                            .font(.caption).bold()
                            .padding(.horizontal, 16)
                            .padding(.vertical, 8)
                            .background(Color(hex: ad.creative.colors.primary))
                            .cornerRadius(8)
                    }
                    .frame(maxWidth: .infinity)
                    .padding()
                    .background(Color(hex: ad.creative.colors.secondary))
                    .cornerRadius(12)
                }
            }
        }
        .task { await fetchAd() }
    }

    func fetchAd() async {
        guard let url = URL(string:
            "https://magicads.dev/api/sdk?pub=YOUR_PUB_ID&format=banner&platform=ios"
        ) else { return }
        do {
            let (data, _) = try await URLSession.shared.data(from: url)
            let response = try JSONDecoder().decode(MagicAdResponse.self, from: data)
            ad = response.ad
        } catch { print("MagicAds:", error) }
    }
}

API Reference

GET /api/sdkFetch an ad as JSON for native rendering
ParamRequiredDescription
pubYesYour publisher ID
formatNobanner | interstitial | rewarded | native
platformNoios | android | react-native | flutter
w / hNoWidth/height hints (default 320x50)
bundleNoApp bundle ID for attribution
keywordsNoComma-separated targeting keywords
testNoSet to "1" for test ads

No SDK binary to install. No App Store review delays. Just an API.