---
updatedAt: 2026-08-06T09:23:45.000Z
agentTools:
  projectIndex: https://developers.alcmeon.com/llms.txt
---

# Add users in an optin

Add one or more users to an optin by their phone numbers. Phone numbers must be in E.164 format (with or without + prefix). Duplicate entries are ignored.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Optins",
    "description": "API for managing optins and user in the optins",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.alcmeon.com",
      "description": "Alcmeon production API server"
    }
  ],
  "x-readme": {
    "explorer-enabled": true
  },
  "paths": {
    "/v1/optins/{optin_id}/user-optins": {
      "post": {
        "summary": "Add users in an optin",
        "description": "Add one or more users to an optin by their phone numbers. Phone numbers must be in E.164 format (with or without + prefix). Duplicate entries are ignored.",
        "operationId": "createUserOptins",
        "tags": [
          "User Optins"
        ],
        "parameters": [
          {
            "name": "optin_id",
            "in": "path",
            "required": true,
            "description": "The ID of the optin",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserOptinsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "User-optins successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateUserOptinsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseError"
                },
                "examples": {
                  "invalidPhoneNumber": {
                    "summary": "Invalid phone number",
                    "value": {
                      "error": "invalid-phone-number",
                      "details": "Invalid phone number: 123"
                    }
                  },
                  "invalidPhoneNumberFormat": {
                    "summary": "Invalid phone number format",
                    "value": {
                      "error": "invalid-phone-number-format",
                      "details": "Invalid phone number format: abc123"
                    }
                  },
                  "emptyList": {
                    "summary": "Empty phone number list",
                    "value": {
                      "error": "empty-phone-number-list",
                      "details": "Phone number list cannot be empty"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Optin not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseError"
                },
                "example": {
                  "error": "optin-not-found",
                  "details": "Optin not found"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached. Default limit is set to 15 requests per minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basic_auth": {
        "description": "Basic authentication using your environment Instance ID as username and Application Secret as password.\n",
        "type": "http",
        "scheme": "basic"
      },
      "bearer_token": {
        "description": "OAuth 2.0 Bearer token authentication.  Obtain a token by calling the /v1/oauth2/token endpoint with your credentials. The token is valid for one hour.\n",
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "CreateUserOptinsRequest": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "integer",
            "description": "ID of the account/site",
            "example": 100
          },
          "user_phone_numbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of phone numbers in E.164 format (with or without + prefix)",
            "example": [
              "+33612345678",
              "33698765432"
            ],
            "minItems": 1
          }
        },
        "required": [
          "account_id",
          "user_phone_numbers"
        ]
      },
      "CreateUserOptinsResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "description": "Number of new user-optins created",
            "example": 1
          },
          "already_existed": {
            "type": "integer",
            "description": "Number of user-optins that already existed",
            "example": 1
          },
          "total_requested": {
            "type": "integer",
            "description": "Total number of phone numbers in the request",
            "example": 2
          }
        },
        "required": [
          "created",
          "already_existed",
          "total_requested"
        ]
      },
      "ResponseError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "A short string explaining the reason of the error.",
            "example": "optin-not-found"
          },
          "details": {
            "type": "string",
            "description": "A short string which describes what is wrong. Provide this string to support@alcmeon.com if you wish to obtain more details about the problem.\n",
            "example": "Optin not found"
          }
        },
        "required": [
          "error"
        ]
      }
    }
  },
  "security": [
    {
      "basic_auth": []
    },
    {
      "bearer_token": []
    }
  ],
  "tags": [
    {
      "name": "User Optins",
      "description": "Operations related to managing users within optins"
    }
  ]
}
```