---
title: Create embed session: Card details
slug: apis/cards/apis/create-embed-session
description: Learn how to create secure single-use card management embed sessions with the CRBCOS sandbox API, CSP iframe restrictions, and code examples.
icon: {"apiMethod":"POST"}
createdAt: 2025-05-07T06:20:49.222Z
---

## API reference

This is the single endpoint a partner backend calls to mint the short-lived, opaque embed session that the cardholder's browser then loads as a P1-hosted iframe. It carries no card data.

:::ApiMethodV2
```json
{
  "name": "Endpoint: /cardmanagement/v1/cards/{id}/embed-session/card-details",
  "method": "POST",
  "url": "https://sandbox.crbcos.com/cardmanagement/v1/cards/{id}/embed-session/card-details",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "hIyb6HxBZBiF03IHcJXah",
        "language": "curl",
        "code": "curl --globoff --request POST \\\n  'https://sandbox.crbcos.com/cardmanagement/v1/cards/{id}/embed-session/card-details' \\\n  --header \"Authorization: Bearer <token>\" \\\n  --header \"Content-Type: application/json\" \\\n  --data '{ \"targetOrigin\": \"https://app.acmepay.io\" }'",
        "customLabel": ""
      },
      {
        "id": "gc3m0KXIIjS1zdDieG_Bg",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://sandbox.crbcos.com/cardmanagement/v1/cards/{id}/embed-session/card-details',\n  'headers': {\n    'Authorization': 'Bearer <token>',\n    'Content-Type': 'application/json'\n  },\n  body: 'curl -X POST \"https://sandbox.crbcos.com/cardmanagement/v1/cards/{cardId}/embed-session/card-details\" \\\\\\r\\n  -H \"Authorization: Bearer <JWT>\" \\\\\\r\\n  -H \"Content-Type: application/json\" \\\\\\r\\n  -d \\'{\\r\\n    \"targetOrigin\": \"[insert target origin here]\"\\r\\n  }\\''\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n"
      },
      {
        "id": "8X5HO88iuDUAXfGW62YuX",
        "language": "python",
        "code": "import requests\nimport json\n\nurl = \"https://sandbox.crbcos.com/cardmanagement/v1/cards/{id}/embed-session/card-details\"\n\npayload = \"curl -X POST \\\"https://sandbox.crbcos.com/cardmanagement/v1/cards/{cardId}/embed-session/card-details\\\" \\\\\\r\\n  -H \\\"Authorization: Bearer <JWT>\\\" \\\\\\r\\n  -H \\\"Content-Type: application/json\\\" \\\\\\r\\n  -d '{\\r\\n    \\\"targetOrigin\\\": \\\"[insert target origin here]\\\"\\r\\n  }'\"\nheaders = {\n  'Authorization': 'Bearer <token>',\n  'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
      },
      {
        "id": "04nG7OK8nMCgS35caD-Es",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://sandbox.crbcos.com/cardmanagement/v1/cards/{id}/embed-session/card-details\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Authorization\"] = \"Bearer <token>\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = \"curl -X POST \\\"https://sandbox.crbcos.com/cardmanagement/v1/cards/{cardId}/embed-session/card-details\\\" \\\\\\r\\n  -H \\\"Authorization: Bearer <JWT>\\\" \\\\\\r\\n  -H \\\"Content-Type: application/json\\\" \\\\\\r\\n  -d '{\\r\\n    \\\"targetOrigin\\\": \\\"[insert target origin here]\\\"\\r\\n  }'\"\n\nresponse = https.request(request)\nputs response.read_body\n"
      },
      {
        "id": "tGlm784C5f1rHbKPWVx9j",
        "language": "go",
        "code": "package main\n\nimport (\n  \"fmt\"\n  \"strings\"\n  \"net/http\"\n  \"io\"\n)\n\nfunc main() {\n\n  url := \"https://sandbox.crbcos.com/cardmanagement/v1/cards/{id}/embed-session/card-details\"\n  method := \"POST\"\n\n  payload := strings.NewReader(`{ \"targetOrigin\": \"https://app.acmepay.io\" }`)\n\n  client := &http.Client {\n  }\n  req, err := http.NewRequest(method, url, payload)\n\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  req.Header.Add(\"Authorization\", \"Bearer <token>\")\n  req.Header.Add(\"Content-Type\", \"application/json\")\n\n  res, err := client.Do(req)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  defer res.Body.Close()\n\n  body, err := io.ReadAll(res.Body)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  fmt.Println(string(body))\n}"
      }
    ],
    "selectedLanguageId": "hIyb6HxBZBiF03IHcJXah"
  },
  "results": {
    "languages": [
      {
        "id": "kcRcUaYhEpL8DHVEgmP34",
        "language": "200",
        "code": "{\n  \"token\": \"string\",\n  \"embedUrl\": \"https://api.hubucsandbox.aws.crbcloud.com/v2/embed?token=string\"\n}",
        "customLabel": ""
      },
      {
        "id": "8-J2_BEMSk6V7Akg5Z7Uv",
        "language": "400",
        "code": "{\n  \"errors\": [\n    { \"code\": 1003, \"message\": \"...\" }\n  ]\n}"
      }
    ],
    "selectedLanguageId": "kcRcUaYhEpL8DHVEgmP34"
  },
  "request": {
    "pathParameters": [
      {
        "name": "id",
        "kind": "required",
        "type": "string",
        "description": "GUID format card ID in the Cross River system, which is the id attribute value of the response to Create a card. This is not the number that appears on the card.",
        "": "required"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "name": "targetOrigin",
        "kind": "required",
        "type": "string",
        "description": "The exact web origin allowed to frame the returned embedUrl (scheme + host, e.g. https://app.acmepay.io). P1 binds this value into the session and returns it as the Content-Security-Policy: frame-ancestors of the iframe document, so the browser only renders the card/keypad when framed by this origin.",
        "": "The exact web origin allowed to frame the returned embedUrl (scheme + host, e.g. https://app.acmepay.io). P1 binds this value into the session and returns it as the Content-Security-Policy: frame-ancestors of the iframe document, so the browser only renders the card/keypad when framed by this origin."
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "response": [
    {
      "name": "token",
      "kind": "optional",
      "type": "string",
      "description": "Short-lived, opaque, single use embed session token for card details. Contains no card data."
    },
    {
      "name": "embedUrl",
      "kind": "optional",
      "type": "string",
      "description": "The P1-hosted URL to load in the iframe (src). The token is already embedded as a query parameter.",
      "children": []
    }
  ],
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "endpoint-cardmanagementv1cardsidembed-sessioncard",
  "legacyHash": "1UvOw4vQXZslD2llxSpJl"
}
```
:::

