---
title: Invite to Account Group
slug: docs/demo/invite-to-account-group
description: Learn how to make a successful POST request to Fictive API and send invites to a specific account group using this code example. Discover the headers required for accepting and sending JSON data and ensure the inclusion of essential parameters like expiry
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "l44DFHeWUYpMnnPhEVPuV",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/groups/{accountGroupToken}/invites",
    "name": "Invite to Account Group",
    "method": "POST",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountGroupToken",
          "type": "string",
          "description": "The account group token used to identify the account group."
        }
      ],
      "queryParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "request",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "expiryDate",
              "type": "string<date-time>",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "subscriptionReferences",
              "type": "array",
              "example": [],
              "itemType": "string",
              "customType": "string[]",
              "itemExample": ""
            },
            {
              "kind": "optional",
              "name": "emailAddresses",
              "type": "array",
              "example": [],
              "itemType": "string",
              "customType": "string[]",
              "itemExample": ""
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.AccountGroupInvitation",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.AccountGroupInvitation",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "validInvitations",
                "type": "array",
                "schema": [
                  {
                    "kind": "optional",
                    "name": "invitationReference",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "kind": "optional",
                    "name": "emailAddress",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "kind": "optional",
                    "name": "expiryDate",
                    "type": "string<date-time>",
                    "example": "2021-09-21T05:33:08.0570737"
                  },
                  {
                    "kind": "optional",
                    "name": "status",
                    "type": "string<PendingAcceptance | Accepted | Revoked | Expired>",
                    "example": ""
                  },
                  {
                    "kind": "optional",
                    "name": "subscriptionReferences",
                    "type": "array",
                    "example": [],
                    "itemType": "string",
                    "customType": "string[]",
                    "itemExample": ""
                  },
                  {
                    "kind": "optional",
                    "name": "created",
                    "type": "string<date-time>",
                    "example": "2021-09-21T05:33:08.0570737"
                  },
                  {
                    "kind": "optional",
                    "name": "lastUpdated",
                    "type": "string<date-time>",
                    "example": "2021-09-21T05:33:08.0570737"
                  }
                ],
                "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.ValidAccountGroupInvitation",
                "customType": "FictiveGlobal.Api.Rest.Dtos.v1.ValidAccountGroupInvitation[]"
              },
              {
                "kind": "optional",
                "name": "invalidEmailAddresses",
                "type": "array",
                "example": [],
                "itemType": "string",
                "customType": "string[]",
                "itemExample": ""
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.AccountGroupProcessedInvitation",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.AccountGroupProcessedInvitation",
            "isExpanded": true
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "No Content",
        "jsonExample": "{\n  \"validInvitations\": [\n    {\n      \"invitationReference\": \"IAFSRAKA6712KABC\",\n      \"emailAddress\": \"jamie.muir@FictiveGlobal.com\",\n      \"expiryDate\": \"2017-07-07T15:41:30\",\n      \"status\": \"PendingAcceptance\",\n      \"subscriptionReferences\": [\n        \"ASJDKAS6712KABCD\",\n        \"ASJDKAS6712KDDEQ\",\n        \"ASJDKAS6712KEWQQ\"\n      ],\n      \"created\": \"0001-01-01T00:00:00\",\n      \"lastUpdated\": \"0001-01-01T00:00:00\"\n    },\n    {\n      \"invitationReference\": \"IBBSRATA6R122ABC\",\n      \"emailAddress\": \"josh.fogg@FictiveGlobal.com\",\n      \"expiryDate\": \"2017-07-07T15:41:30\",\n      \"status\": \"PendingAcceptance\",\n      \"subscriptionReferences\": [\n        \"ASJDKAS6712KABCD\",\n        \"ASJDKAS6712KDDEQ\",\n        \"ASJDKAS6712KEWQQ\"\n      ],\n      \"created\": \"0001-01-01T00:00:00\",\n      \"lastUpdated\": \"0001-01-01T00:00:00\"\n    }\n  ],\n  \"invalidEmailAddresses\": [\n    \"jim pimblett@FictiveGlobal.com\",\n    \"alex.marinescu@FictiveGlobal\"\n  ]\n}"
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Request is invalid.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "403",
        "description": "Unable to authenticate using the provided session.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Subscription not found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal Server Error.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will enable you to invite accounts to a specific account group, and optionally, an account group subscription.",
    "examples": {
      "languages": [
        {
          "id": "mWgqzFraGEZJc4p8isN7o",
          "language": "curl",
          "label": "cURL",
          "code": "curl --location --globoff 'https://api.fictive.com/REST/api/accounts/groups/{accountGroupToken}/invites' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"expiryDate\": \"\",\n  \"subscriptionReferences\": [\n    \"\"\n  ],\n  \"emailAddresses\": [\n    \"\"\n  ]\n}'"
        },
        {
          "id": "r7l0YU0gnG2JtFozJoXj_",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"expiryDate\": \"\",\n   \"subscriptionReferences\": [\n      \"\"\n   ],\n   \"emailAddresses\": [\n      \"\"\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/groups/{accountGroupToken}/invites\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "4ZtnmHyzqoUq5wSLITHzl",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/groups/{accountGroupToken}/invites\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"expiryDate\": \"\",\n   \"subscriptionReferences\": [\n      \"\"\n   ],\n   \"emailAddresses\": [\n      \"\"\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Pt-V51R06MiZJNZDQ3g6k",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/groups/{accountGroupToken}/invites\"\n\npayload = json.dumps({\n   \"expiryDate\": \"\",\n   \"subscriptionReferences\": [\n      \"\"\n   ],\n   \"emailAddresses\": [\n      \"\"\n   ]\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "mWgqzFraGEZJc4p8isN7o"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n  \"validInvitations\": [\n    {\n      \"invitationReference\": \"IAFSRAKA6712KABC\",\n      \"emailAddress\": \"jamie.muir@FictiveGlobal.com\",\n      \"expiryDate\": \"2017-07-07T15:41:30\",\n      \"status\": \"PendingAcceptance\",\n      \"subscriptionReferences\": [\n        \"ASJDKAS6712KABCD\",\n        \"ASJDKAS6712KDDEQ\",\n        \"ASJDKAS6712KEWQQ\"\n      ],\n      \"created\": \"0001-01-01T00:00:00\",\n      \"lastUpdated\": \"0001-01-01T00:00:00\"\n    },\n    {\n      \"invitationReference\": \"IBBSRATA6R122ABC\",\n      \"emailAddress\": \"josh.fogg@FictiveGlobal.com\",\n      \"expiryDate\": \"2017-07-07T15:41:30\",\n      \"status\": \"PendingAcceptance\",\n      \"subscriptionReferences\": [\n        \"ASJDKAS6712KABCD\",\n        \"ASJDKAS6712KDDEQ\",\n        \"ASJDKAS6712KEWQQ\"\n      ],\n      \"created\": \"0001-01-01T00:00:00\",\n      \"lastUpdated\": \"0001-01-01T00:00:00\"\n    }\n  ],\n  \"invalidEmailAddresses\": [\n    \"jim pimblett@FictiveGlobal.com\",\n    \"alex.marinescu@FictiveGlobal\"\n  ]\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Request is invalid.\n"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Unable to authenticate using the provided session.\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Subscription not found\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal Server Error.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}