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

# Crear instancia de Instagram

> Conecta una cuenta de Instagram a su workspace — el perfil por el que envía y recibe DMs. Elija el ejemplo: - **No oficial: login con contraseña** — usuario y contraseña de Instagram (acepte términos).
- **No oficial: reanudación con 2FA** — cuando Meta pide código de verificación.
- **Oficial: enlace para el cliente** — el cliente completa el login Meta por enlace.
- **Oficial: credenciales Meta al momento** — registro Meta ya hecho en el navegador.
- **Oficial: token Meta propio (BYOK)** — token, Page ID e Instagram Business ID que ya posee. Ámbito: **instagram:instances:create**.



## OpenAPI

````yaml /es/instagram-api/api-reference/openapi-instagram.json post /v1/instagram/instances
openapi: 3.0.3
info:
  title: Notifique API — Instagram
  version: 1.0.0
  description: >-
    Envíe DMs de Instagram y gestione conexiones. Autentíquese con
    `Authorization: Bearer sk_live_...` o `x-api-key`.
servers:
  - url: https://api.notifique.dev
    description: Producción
security:
  - ntfIgBearerAuth: []
  - ntfIgApiKeyHeader: []
tags:
  - name: 'Instagram: instancias'
    description: Criar, listar, desconectar e remover conexões Instagram.
  - name: 'Instagram: mensajes'
    description: Enviar, listar, editar, cancelar, apagar e inbound.
  - name: 'Instagram: comentarios'
    description: Listar, responder e moderar comentários.
  - name: 'Instagram: media'
    description: >-
      Publicaciones y media reciente de la cuenta (disparadores de
      automatización).
paths:
  /v1/instagram/instances:
    post:
      tags:
        - 'Instagram: instâncias'
      summary: Crear instancia de Instagram
      description: >-
        Conecta una cuenta de Instagram a su workspace — el perfil por el que
        envía y recibe DMs. Elija el ejemplo: - **No oficial: login con
        contraseña** — usuario y contraseña de Instagram (acepte términos).

        - **No oficial: reanudación con 2FA** — cuando Meta pide código de
        verificación.

        - **Oficial: enlace para el cliente** — el cliente completa el login
        Meta por enlace.

        - **Oficial: credenciales Meta al momento** — registro Meta ya hecho en
        el navegador.

        - **Oficial: token Meta propio (BYOK)** — token, Page ID e Instagram
        Business ID que ya posee. Ámbito: **instagram:instances:create**.
      operationId: ntfIg_createInstance
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NtfIg_CreateInstanceBody'
            examples:
              unofficialPassword:
                summary: 'No oficial: login con contraseña'
                description: >-
                  Conexión por usuario y contraseña. Obligatorio aceptar
                  términos.
                value:
                  name: Instagram atención
                  acceptInstagramTerms: true
                  auth:
                    mode: password
                    username: su_usuario
                    password: su_contraseña
                  expectedUsername: su_usuario
              unofficialTwoFactor:
                summary: 'No oficial: reanudación con 2FA'
                description: Cuando Instagram pide código tras usuario/contraseña.
                value:
                  name: Instagram atención
                  acceptInstagramTerms: true
                  auth:
                    mode: password
                    username: su_usuario
                    password: su_contraseña
                    verificationCode: '123456'
              officialLinkForCustomer:
                summary: 'Oficial: enlace para que el cliente conecte Meta'
                description: El cliente abre el enlace y completa el login Meta.
                value:
                  name: Instagram oficial
                  mode: OFFICIAL
                  generateShareableLink: true
              officialWithMetaCredentials:
                summary: 'Oficial: credenciales Meta al momento'
                description: Use cuando el Facebook Login ya se completó en el navegador.
                value:
                  name: Instagram oficial
                  mode: OFFICIAL
                  metaEmbeddedCode: CODE_EMBEDDED_SIGNUP
                  facebookPageId: '123456789012345'
                  igBusinessAccountId: '17841400000000000'
              officialByok:
                summary: 'Oficial: token Meta propio (BYOK)'
                description: Línea oficial con token e IDs de su cuenta Meta.
                value:
                  name: Instagram BYOK
                  mode: OFFICIAL_BYOK
                  metaAccessToken: EAAG...
                  facebookPageId: '123456789012345'
                  igBusinessAccountId: '17841400000000000'
      responses:
        '200':
          description: Instancia criada (ACTIVE ou PENDING com shareableLink).
          content:
            application/json:
              examples:
                active:
                  summary: Conexão ACTIVE
                  value:
                    success: true
                    data:
                      id: inst_abc
                      name: Instagram atendimento
                      status: ACTIVE
                      mode: UNOFFICIAL
                      username: seu_usuario
                      igUserPk: '17841'
                officialShareable:
                  summary: Draft oficial com link (pending_signup)
                  value:
                    success: true
                    data:
                      id: inst_abc
                      name: Instagram oficial
                      status: PENDING
                      mode: OFFICIAL
                      connectionKind: META_EMBEDDED
                      instagramOfficialCloud: true
                      connection:
                        status: pending_signup
                        message: >-
                          Open shareableLink.hostedUrl for the customer to
                          complete Meta login.
                      shareableLink:
                        hostedUrl: >-
                          https://api.notifique.dev/w/instance-connect/...?token=...
                        embedUrl: >-
                          https://api.notifique.dev/w/embed/instance-connect/...?token=...
                        publicId: ...
              schema:
                $ref: '#/components/schemas/ntfIg_CreateInstanceResponse'
        '400':
          description: Validação ou login falhou.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfIg_ErrorResponse'
              examples:
                terms:
                  summary: Termos
                  value:
                    success: false
                    error: Bad Request
                    message: 'acceptInstagramTerms: true is required.'
                    code: INSTAGRAM_TERMS_REQUIRED
                login:
                  summary: Login
                  value:
                    success: false
                    error: Bad Request
                    message: Login failed
                    code: INSTAGRAM_LOGIN_FAILED
        '402':
          description: Plano expirado ou suspenso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfIg_ErrorResponse'
              example:
                success: false
                error: Bad Request
                code: VALIDATION_ERROR
                message: Campo inválido ou ausente.
        '403':
          description: Sem escopo ou limite de instancias do plano.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfIg_ErrorResponse'
              example:
                success: false
                error: Bad Request
                code: VALIDATION_ERROR
                message: Campo inválido ou ausente.
        '409':
          description: Conta logada ≠ locked/expected (INSTAGRAM_ACCOUNT_MISMATCH).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfIg_ErrorResponse'
              example:
                success: false
                error: Conflict
                code: INSTAGRAM_ACCOUNT_MISMATCH
                message: >-
                  This Instagram account does not match the account locked to
                  this instance. Create a new instance to use a different
                  account.
                data:
                  id: inst_abc
                  status: PENDING
        '428':
          description: 2FA ou desafio de segurança.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfIg_ErrorResponse'
              examples:
                twoFactor:
                  summary: 2FA
                  value:
                    success: false
                    error: Authentication Required
                    code: INSTAGRAM_TWO_FACTOR_REQUIRED
                    message: Two-factor authentication required
                challenge:
                  summary: Challenge
                  value:
                    success: false
                    error: Authentication Required
                    code: INSTAGRAM_CHALLENGE_REQUIRED
                    message: Security challenge required
                    data:
                      challenge:
                        step_name: verify_code
        '429':
          description: >-
            Muitas criações em paralelo, cooldown de reconexão
            (INSTAGRAM_RECONNECT_COOLDOWN) ou pause por abuso
            (INSTAGRAM_ABUSE_PAUSE). Pode incluir retryAfterSec.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/NtfIg_ErrorResponse'
                  - type: object
                    properties:
                      retryAfterSec:
                        type: integer
                        description: Segundos até poder tentar connect/challenge de novo.
              examples:
                cooldown:
                  summary: Cooldown
                  value:
                    success: false
                    error: Too Many Requests
                    code: INSTAGRAM_RECONNECT_COOLDOWN
                    message: >-
                      Reconnection is temporarily blocked after an involuntary
                      disconnect. Wait before logging in again, or create a new
                      instance.
                    retryAfterSec: 43200
                abuse:
                  summary: Abuse pause
                  value:
                    success: false
                    error: Too Many Requests
                    code: INSTAGRAM_ABUSE_PAUSE
                    message: >-
                      This Instagram account is temporarily paused after an
                      abuse or rate-limit signal.
                    retryAfterSec: 43200
        '503':
          description: Capacidade global de conexões cheia.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfIg_ErrorResponse'
components:
  schemas:
    NtfIg_CreateInstanceBody:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 2
          example: Instagram atendimento
        acceptInstagramTerms:
          type: boolean
          enum:
            - true
          description: >-
            Obrigatório no modo UNOFFICIAL. Confirma ciência do risco de
            restrição pela plataforma.
        mode:
          type: string
          enum:
            - UNOFFICIAL
            - OFFICIAL
            - OFFICIAL_BYOK
          description: >-
            Tipo de conexión. **UNOFFICIAL** (predeterminado): login Instagram.
            **OFFICIAL**: línea Meta. **OFFICIAL_BYOK**: token e IDs Meta
            propios.
          default: UNOFFICIAL
        generateShareableLink:
          type: boolean
          default: false
          description: >-
            Genera un enlace para que otra persona termine la conexión Meta.
            Omita cuando envía credenciales en esta solicitud.
        metaAccessToken:
          type: string
          description: Page Access Token (OFFICIAL_BYOK).
        facebookPageId:
          type: string
          description: Facebook Page ID vinculada à conta IG (OFFICIAL_BYOK).
        igBusinessAccountId:
          type: string
          description: Instagram Business Account ID (OFFICIAL_BYOK).
        metaAppSecret:
          type: string
          description: App Secret Meta para validar webhooks (OFFICIAL_BYOK).
        metaEmbeddedCode:
          type: string
          description: >-
            Código do Facebook Login (OFFICIAL). Alternativa:
            generateShareableLink=true.
        expectedUsername:
          type: string
          description: >-
            Opcional. Username esperado no login (conexão no oficial). Se o
            login conectar outra conta, a API responde 409
            (INSTAGRAM_ACCOUNT_MISMATCH).
          example: seu_usuario
        termsVersion:
          type: string
          example: v1
        locale:
          type: string
          example: pt-BR
        timezone:
          type: string
          example: America/Sao_Paulo
        auth:
          type: object
          required:
            - mode
            - username
            - password
          properties:
            mode:
              type: string
              enum:
                - password
            username:
              type: string
            password:
              type: string
              format: password
            verificationCode:
              type: string
              description: Código 2FA quando a API retornou INSTAGRAM_TWO_FACTOR_REQUIRED.
      example:
        name: Instagram atendimento
        acceptInstagramTerms: true
        mode: UNOFFICIAL
        generateShareableLink: false
        metaAccessToken: string
        facebookPageId: clxx...
        igBusinessAccountId: clxx...
        metaAppSecret: string
        metaEmbeddedCode: string
        expectedUsername: seu_usuario
        termsVersion: v1
        locale: pt-BR
        timezone: America/Sao_Paulo
        auth:
          mode: password
          username: string
          password: string
          verificationCode: string
    ntfIg_CreateInstanceResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            id:
              type: string
              example: inst_abc
            name:
              type: string
              example: Instagram atendimento
            status:
              type: string
              example: ACTIVE
            mode:
              type: string
              example: UNOFFICIAL
            username:
              type: string
              example: seu_usuario
            igUserPk:
              type: string
              example: '17841'
            connectionKind:
              type: string
              example: META_EMBEDDED
            instagramOfficialCloud:
              type: boolean
              example: true
            connection:
              type: object
              additionalProperties: true
              example:
                status: pending_signup
                message: >-
                  Open shareableLink.hostedUrl for the customer to complete Meta
                  login.
              properties:
                status:
                  type: string
                  example: pending_signup
                message:
                  type: string
                  example: >-
                    Open shareableLink.hostedUrl for the customer to complete
                    Meta login.
            shareableLink:
              type: object
              additionalProperties: true
              example:
                hostedUrl: https://api.notifique.dev/w/instance-connect/...?token=...
                embedUrl: >-
                  https://api.notifique.dev/w/embed/instance-connect/...?token=...
                publicId: ...
              properties:
                hostedUrl:
                  type: string
                  example: https://api.notifique.dev/w/instance-connect/...?token=...
                embedUrl:
                  type: string
                  example: >-
                    https://api.notifique.dev/w/embed/instance-connect/...?token=...
                publicId:
                  type: string
                  example: ...
      example:
        success: true
        data:
          id: inst_abc
          name: Instagram atendimento
          status: ACTIVE
          mode: UNOFFICIAL
          username: seu_usuario
          igUserPk: '17841'
          connectionKind: META_EMBEDDED
          instagramOfficialCloud: true
          connection:
            status: pending_signup
            message: >-
              Open shareableLink.hostedUrl for the customer to complete Meta
              login.
          shareableLink:
            hostedUrl: https://api.notifique.dev/w/instance-connect/...?token=...
            embedUrl: https://api.notifique.dev/w/embed/instance-connect/...?token=...
            publicId: ...
    NtfIg_ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        message:
          type: string
        code:
          type: string
        details:
          type: object
          additionalProperties: true
        data:
          type: object
          additionalProperties: true
          properties:
            id:
              type: string
              example: inst_abc
            status:
              type: string
              example: PENDING
            active:
              type: boolean
              example: true
            dailyLimit:
              type: integer
              example: 15
            sentToday:
              type: integer
              example: 15
            daysRemaining:
              type: integer
              example: 4
        retryAfterSec:
          type: integer
          description: >-
            Segundos até poder tentar de novo (presente em 429 de cooldown/abuse
            pause).
      example:
        success: false
        error: string
        message: string
        code: string
        details: {}
        data: {}
        retryAfterSec: 1
  securitySchemes:
    ntfIgBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Authorization: Bearer sk_live_...'
    ntfIgApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````