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

# Manage Mobile Apps

> Complete guide to creating, updating, and managing mobile app configurations via API

## Overview

This guide covers the complete lifecycle of mobile app management in Bit2Connect, from creation to deletion, using the Public API.

## Creating Mobile Apps

### iOS App Example

```bash cURL theme={null}
curl -X POST "https://api.bit2connect.com/1.0/mobile-apps" \
  -H "X-API-KEY: b2co_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "IOS",
    "name": "My iOS App",
    "bundleId": "com.mycompany.myapp",
    "appStoreFallback": "https://apps.apple.com/app/id123456789",
    "appStoreId": "123456789",
    "iosMinVersion": "14.0"
  }'
```

### Android App Example

```bash cURL theme={null}
curl -X POST "https://api.bit2connect.com/1.0/mobile-apps" \
  -H "X-API-KEY: b2co_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "ANDROID",
    "name": "My Android App",
    "packageName": "com.mycompany.myapp",
    "playStoreFallback": "https://play.google.com/store/apps/details?id=com.mycompany.myapp",
    "androidMinVersion": "21"
  }'
```

## Listing Mobile Apps

Retrieve all mobile apps in your project:

```bash cURL theme={null}
curl -X GET "https://api.bit2connect.com/1.0/mobile-apps" \
  -H "X-API-KEY: b2co_your_api_key"
```

The response includes both iOS and Android apps with platform-specific fields:

```json Response theme={null}
{
  "success": true,
  "data": {
    "apps": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "My iOS App",
        "platform": "IOS",
        "bundleId": "com.mycompany.myapp",
        "appStoreFallback": "https://apps.apple.com/app/id123456789",
        "appStoreId": "123456789",
        "iosMinVersion": "14.0",
        "packageName": null,
        "playStoreFallback": null,
        "androidMinVersion": null
      },
      {
        "id": "550e8400-e29b-41d4-a716-446655440001",
        "name": "My Android App",
        "platform": "ANDROID",
        "bundleId": null,
        "appStoreFallback": null,
        "appStoreId": null,
        "iosMinVersion": null,
        "packageName": "com.mycompany.myapp",
        "playStoreFallback": "https://play.google.com/store/apps/details?id=com.mycompany.myapp",
        "androidMinVersion": "21"
      }
    ],
    "total": 2
  }
}
```

## Updating Mobile Apps

Update specific fields of an existing mobile app:

```bash Update App Store URL theme={null}
curl -X PUT "https://api.bit2connect.com/1.0/mobile-apps/550e8400-e29b-41d4-a716-446655440000" \
  -H "X-API-KEY: b2co_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "appStoreFallback": "https://apps.apple.com/app/id987654321",
    "appStoreId": "987654321"
  }'
```

<Info>
  **Partial Updates**: You only need to include the fields you want to change. The platform cannot be modified after creation.
</Info>

## Deleting Mobile Apps

Remove a mobile app from your project:

```bash cURL theme={null}
curl -X DELETE "https://api.bit2connect.com/1.0/mobile-apps/550e8400-e29b-41d4-a716-446655440000" \
  -H "X-API-KEY: b2co_your_api_key"
```

<Warning>
  **Impact on Links**: Deleting a mobile app will remove its association from any dynamic links currently using it. The links will continue to work but will lose their mobile app configuration.
</Warning>

## Integration Workflows

### Workflow 1: Pre-register Apps

1. **Create mobile apps** for your iOS and Android applications
2. **Save the app IDs** returned from the API
3. **Create dynamic links** using the saved app IDs

```javascript JavaScript Example theme={null}
// Step 1: Create mobile apps
const iosApp = await createMobileApp({
  platform: 'IOS',
  name: 'My iOS App',
  bundleId: 'com.mycompany.myapp',
  appStoreFallback: 'https://apps.apple.com/app/id123456789'
});

const androidApp = await createMobileApp({
  platform: 'ANDROID',
  name: 'My Android App',
  packageName: 'com.mycompany.myapp',
  playStoreFallback: 'https://play.google.com/store/apps/details?id=com.mycompany.myapp'
});

// Step 2: Create links using saved apps
const link = await createLink({
  payload: {
    link: 'https://yourapp.com/content',
    iosAppId: iosApp.data.id,
    androidAppId: androidApp.data.id
  }
});
```

### Workflow 2: Save During Link Creation

Create and save mobile app configurations while creating dynamic links:

```javascript JavaScript Example theme={null}
const link = await createLink({
  payload: {
    link: 'https://yourapp.com/content',
    ios: {
      bundleId: 'com.mycompany.myapp',
      app_store_fallback: 'https://apps.apple.com/app/id123456789',
      saveApp: true,
      appName: 'My iOS App'
    },
    android: {
      package: 'com.mycompany.myapp',
      store_fallback: 'https://play.google.com/store/apps/details?id=com.mycompany.myapp',
      saveApp: true,
      appName: 'My Android App'
    }
  }
});
```

## Error Handling

Common error scenarios and how to handle them:

### App Not Found

```json theme={null}
{
  "success": false,
  "error": "Mobile app not found",
  "timestamp": "2024-01-15T12:00:00Z"
}
```

### Validation Errors

```json theme={null}
{
  "success": false,
  "error": "Validation failed",
  "details": [
    "bundleId is required for iOS apps",
    "appStoreFallback must be a valid URL"
  ],
  "timestamp": "2024-01-15T12:00:00Z"
}
```

### Platform Mismatch

```json theme={null}
{
  "success": false,
  "error": "Cannot change platform after creation",
  "timestamp": "2024-01-15T12:00:00Z"
}
```

## Next Steps

* [Using Saved Apps](/guides/using-saved-apps) - Learn how to use saved mobile apps in dynamic links
* [Mobile Apps API Reference](/api-reference/mobile-apps/create) - Complete API documentation
* [Create Dynamic Links](/guides/create-link) - Learn how to create links with mobile app configurations
