# Instagram Integration via LowCodeAPI

**Last Updated**: January 27, 2025

## Overview
Instagram Graph API for managing Instagram Business and Creator accounts

**Categories:**
- {'id': 'social-media', 'name': 'Social Media'}

## Base Endpoint
https://api.lowcodeapi.com/instagram

**Important**: Always include the provider name in the URL path after `api.lowcodeapi.com/`

## Authentication
**Type:** OAUTH2.0

**Official Documentation:** https://developers.facebook.com/docs/instagram-api

## URL Format (Important)

LowCodeAPI supports two URL formats. **Always try the New Format first**, then fall back to Old Format if needed.

### New Format (Priority)
- Path parameters stay in the URL path
- Do NOT include path parameters as query parameters
- Example: `https://api.lowcodeapi.com/{provider}/resource/{id}?api_token=XXX`

### Old Format (Fallback)
- Path parameters become query parameters
- Example: `https://api.lowcodeapi.com/{provider}/resource/id?id={id}&api_token=XXX`

### Decision Flow for AI Agents
1. Always use **New Format** first - keep path parameters in the URL path
2. If you get a 404 or error, try **Old Format** with sanitized path
3. Log which format worked for future requests to this provider

## API Categories

## Common Endpoints

### Get Instagram Business Account

**Method:** GET
**LowCodeAPI Path:** /v20.0/<IG_USER_ID>

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_user_id?IG_USER_ID={IG_USER_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_USER_ID | string |  |

**Query Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| fields | array |  |

**Example Request (New Format):**

```bash
curl -X GET 'https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-user

### Get Media Objects

**Method:** GET
**LowCodeAPI Path:** /v20.0/<IG_USER_ID>/media

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>/media?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_user_id/media?IG_USER_ID={IG_USER_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_USER_ID | string |  |

**Query Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| after | string |  |
| before | string |  |
| fields | array |  |
| limit | number |  |

**Example Request (New Format):**

```bash
curl -X GET 'https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>/media?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-user/media

### Create Media Container

**Method:** POST
**LowCodeAPI Path:** /v20.0/<IG_USER_ID>/media

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>/media?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_user_id/media?IG_USER_ID={IG_USER_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_USER_ID | string |  |

**Request Body:**

| Field | Type | Description |
|-------|------|-------------|
| caption | string |  |
| children | string |  |
| image_url | string |  |
| is_carousel_item | boolean |  |
| location_id | string |  |
| media_type | string |  |
| product_tags | array |  |
| thumb_offset | number |  |
| user_tags | array |  |
| video_url | string |  |

**Example Request (New Format):**

```bash
curl -X POST 'https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>/media?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#creating

### Publish Media Container

**Method:** POST
**LowCodeAPI Path:** /v20.0/<IG_USER_ID>/media_publish

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>/media_publish?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_user_id/media_publish?IG_USER_ID={IG_USER_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_USER_ID | string |  |

**Request Body:**

| Field | Type | Description |
|-------|------|-------------|
| creation_id | string |  |

**Example Request (New Format):**

```bash
curl -X POST 'https://api.lowcodeapi.com/instagram/v20.0/<IG_USER_ID>/media_publish?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-user/media_publish

### Get Media Object Details

**Method:** GET
**LowCodeAPI Path:** /v20.0/<IG_MEDIA_ID>

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_media_id?IG_MEDIA_ID={IG_MEDIA_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_MEDIA_ID | string |  |

**Query Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| fields | array |  |

**Example Request (New Format):**

```bash
curl -X GET 'https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-media

### Delete Media

**Method:** DELETE
**LowCodeAPI Path:** /v20.0/<IG_MEDIA_ID>

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_media_id?IG_MEDIA_ID={IG_MEDIA_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_MEDIA_ID | string |  |

**Example Request (New Format):**

```bash
curl -X DELETE 'https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-media#deleting

### Get Comments on Media

**Method:** GET
**LowCodeAPI Path:** /v20.0/<IG_MEDIA_ID>/comments

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>/comments?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_media_id/comments?IG_MEDIA_ID={IG_MEDIA_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_MEDIA_ID | string |  |

**Query Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| after | string |  |
| before | string |  |
| fields | array |  |
| limit | number |  |

**Example Request (New Format):**

```bash
curl -X GET 'https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>/comments?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-media/comments

### Create Comment

**Method:** POST
**LowCodeAPI Path:** /v20.0/<IG_MEDIA_ID>/comments

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>/comments?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_media_id/comments?IG_MEDIA_ID={IG_MEDIA_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_MEDIA_ID | string |  |

**Request Body:**

| Field | Type | Description |
|-------|------|-------------|
| message | string |  |

**Example Request (New Format):**

```bash
curl -X POST 'https://api.lowcodeapi.com/instagram/v20.0/<IG_MEDIA_ID>/comments?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-media/comments#creating

### Get Comment Details

**Method:** GET
**LowCodeAPI Path:** /v20.0/<IG_COMMENT_ID>

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_COMMENT_ID>?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_comment_id?IG_COMMENT_ID={IG_COMMENT_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_COMMENT_ID | string |  |

**Query Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| fields | array |  |

**Example Request (New Format):**

```bash
curl -X GET 'https://api.lowcodeapi.com/instagram/v20.0/<IG_COMMENT_ID>?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-comment

### Delete Comment

**Method:** DELETE
**LowCodeAPI Path:** /v20.0/<IG_COMMENT_ID>

**New Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/<IG_COMMENT_ID>?api_token=YOUR_API_TOKEN

**Old Format URL:**
https://api.lowcodeapi.com/instagram/v20.0/ig_comment_id?IG_COMMENT_ID={IG_COMMENT_ID}&api_token=YOUR_API_TOKEN

**Path Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| IG_COMMENT_ID | string |  |

**Example Request (New Format):**

```bash
curl -X DELETE 'https://api.lowcodeapi.com/instagram/v20.0/<IG_COMMENT_ID>?api_token=YOUR_API_TOKEN'
```

**Official Documentation:** https://developers.facebook.com/docs/instagram-api/reference/ig-comment#deleting


## Usage Examples

### Example 1: Get User Profile

```bash
# Get current user information
curl -X GET "https://api.lowcodeapi.com/instagram/user?api_token=YOUR_API_TOKEN"
```

### Example 2: List Messages or Posts

```bash
# Get list of messages/posts
curl -X GET "https://api.lowcodeapi.com/instagram/messages?api_token=YOUR_API_TOKEN"
```

### Example 3: Send Message or Create Post

```bash
# Send a message
curl -X POST "https://api.lowcodeapi.com/instagram/chat.postMessage?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "CHANNEL_ID",
    "text": "Hello from Instagram!"
  }'
```

## Error Handling

LowCodeAPI returns standard HTTP status codes. Common errors:

| Status Code | Description |
|-------------|-------------|
| 200 | Success - Request completed successfully |
| 400 | Bad Request - Invalid parameters or request body |
| 401 | Unauthorized - Invalid or missing API token |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Endpoint or resource doesn't exist |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Server Error - Provider API error |

All error responses include error details:

```json
{
  "data": {
    "error": {
      "message": "Error description",
      "code": "ERROR_CODE"
    }
  }
}
```

## Complete Endpoint Reference

| Endpoint | Method | Category |
|----------|--------|----------|
| Get Instagram Business Account | GET | Account |
| Get Media Objects | GET | Media |
| Create Media Container | POST | Media |
| Publish Media Container | POST | Media |
| Get Media Object Details | GET | Media |
| Delete Media | DELETE | Media |
| Get Comments on Media | GET | Comments |
| Create Comment | POST | Comments |
| Get Comment Details | GET | Comments |
| Delete Comment | DELETE | Comments |
| Get Comment Replies | GET | Comments |
| Reply to Comment | POST | Comments |
| Get Account Insights | GET | Insights |
| Get Media Insights | GET | Insights |
| Get Story Insights | GET | Insights |
| Get Recently Searched Hashtags | GET | Hashtags |
| Get Hashtag Information | GET | Hashtags |
| Get Top Media for Hashtag | GET | Hashtags |
| Get Recent Media for Hashtag | GET | Hashtags |
| Search Hashtag | GET | Hashtags |
| Get Mentions | GET | Mentions |
| Get Stories | GET | Stories |
| Get Story Details | GET | Stories |
| Get Reels | GET | Reels |
| Create Reel Container | POST | Reels |
| Publish Reel | POST | Reels |
| Get Likes on Media | GET | Likes |
| Like Media | POST | Likes |
| Unlike Media | DELETE | Likes |
| Get Tagged Media | GET | Tags |
| Get Live Media | GET | Live |
| Get Shopping Product Tags | GET | Shopping |
| Get Content Publishing Limit | GET | Publishing |
| Search User | GET | Users |
| Get Media Containers | GET | Containers |
| Get Container Status | GET | Containers |
| Get Product Appeals | GET | Shopping |
| Create Product Appeal | POST | Shopping |
| Batch Request | POST | Batch |

## API Definition Endpoints

You can fetch the complete API specification for this provider:

**New Format (OpenAPI spec):**
```bash
curl 'https://backend.lowcodeapi.com/instagram/openapi'
```

**Old Format (API definition):**
```bash
curl 'https://backend.lowcodeapi.com/instagram/definition'
```

## Response Format

All responses are wrapped in a `data` key:

```json
{
  "data": {
    // Actual response from provider (object or array)
  }
}
```