> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.getkard.com/2024-10-01/api/organizations/placements/create/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getkard.com/_mcp/server. # Create POST https://rewards-api.getkard.com/v2/issuers/{organizationId}/placements Content-Type: application/json Create a placement for the organization. Use type "placement" for standard placements (requires name and availableSlots), "placementPushNotification" for push-notification placements (requires name and cadence; availableSlots is automatically set to 1), "placementEmail" for email placements (requires name, cadence, and availableSlots), "placementBatchActivation" for batch-activation placements (requires name, refreshInterval, and slots), or "placementGroup" for group placements (requires name and slots). Reference: https://docs.getkard.com/api/organizations/placements/create ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://rewards-api.getkard.com` (Production, default) - `https://test-rewards-api.getkard.com` (Sandbox) ## Request ### Path parameters - `organizationId` (string, required) — Unique identifier of the organization ### Body (application/json) This endpoint expects a CreatePlacementRequestBody. - `data` (CreatePlacementDataUnion, required) — Placement data for creation ## Response ### 201 Created placement resource - `PlacementFormatUnion` - `type`: `placement` - `attributes` (PlacementAttributes, required) — Attributes for a standard placement - `id` (string, required) — Unique identifier of the placement (UUID v7) - `relationships` (PlacementRelationships, optional) — JSON:API relationships for the placement. Omitted entirely when the placement has no linked resources. - `type`: `placementPushNotification` - `attributes` (PushNotificationPlacementAttributes, required) — Attributes for a push-notification placement - `id` (string, required) — Unique identifier of the placement (UUID v7) - `relationships` (PlacementRelationships, optional) — JSON:API relationships for the placement. Omitted entirely when the placement has no linked resources. - `type`: `placementEmail` - `attributes` (EmailPlacementAttributes, required) — Attributes for an email placement - `id` (string, required) — Unique identifier of the placement (UUID v7) - `relationships` (PlacementRelationships, optional) — JSON:API relationships for the placement. Omitted entirely when the placement has no linked resources. - `type`: `placementBatchActivation` - `attributes` (BatchActivationPlacementAttributes, required) — Attributes for a batch-activation placement. Slot detail is exposed via `relationships.slots` (resource identifiers) and the `batchActivationSlot` entries in `included`; request `?include=slots` (or a deeper path) to get the slot details. - `id` (string, required) — Unique identifier of the placement (UUID v7) - `relationships` (SlottedPlacementRelationships, required) — JSON:API relationships for the placement. Always present on a batch-activation placement; the `slots` to-many relationship lists the slot resource identifiers. - `type`: `placementGroup` - `attributes` (GroupPlacementAttributes, required) — Attributes for a group placement. A group is configured like a batch-activation placement but has no refreshInterval. Slot detail is exposed via `relationships.slots` (resource identifiers) and the `batchActivationSlot` entries in `included`; request `?include=slots` (or a deeper path) to get the slot details. - `id` (string, required) — Unique identifier of the placement (UUID v7) - `relationships` (SlottedPlacementRelationships, required) — JSON:API relationships for the placement. Always present on a group placement; the `slots` to-many relationship lists the slot resource identifiers. ## Errors ### 401 Unauthorized Error - `errors` (list of ErrorObject, required) ### 403 Forbidden Error - `errors` (list of ErrorObject, required) ### 400 Invalid Request - `errors` (list of ErrorObject, required) ### 404 Does Not Exist Error - `errors` (list of ErrorObject, required) ### 500 Internal Server Error - `errors` (list of ErrorObject, required) ## Types ### CreatePlacementDataUnion Discriminated union for creating a placement - `type`: `placement` - `attributes` (CreateStandardAttributes, required) — Standard placement attributes for creation - `type`: `placementPushNotification` - `attributes` (CreatePushNotificationAttributes, required) — Push-notification placement attributes for creation - `type`: `placementEmail` - `attributes` (CreateEmailAttributes, required) — Email placement attributes for creation - `type`: `placementBatchActivation` - `attributes` (CreateBatchActivationAttributes, required) — Batch-activation placement attributes for creation - `type`: `placementGroup` - `attributes` (CreateGroupAttributes, required) — Group placement attributes for creation ### PlacementAttributes Attributes for a standard placement - `name` (string, required) — Name of the placement - `organizationId` (string, required) — ID of the organization this placement belongs to - `availableSlots` (integer, required) — Number of available slots - `displayName` (string, optional) — Cardholder-facing title for the section, if one was set. When absent, clients fall back to their own default label. - `contentStrategyId` (string, optional) — ID of the content strategy linked to this placement, if any. Retained alongside `relationships.contentStrategy` for backward compatibility. ### PlacementRelationships Relationship block for non-batch placements. Mirrors the `contentStrategyId` attribute so JSON:API clients can walk the graph. - `contentStrategy` (ToOneRelationship, optional) — Relationship to the content strategy that powers this placement. Present whenever the placement has been linked to a content strategy (`data.id` will be set). Omitted entirely when no content strategy is linked. ### PushNotificationPlacementAttributes Attributes for a push-notification placement - `name` (string, required) — Name of the placement - `status` (enum, required) — Whether the placement's scheduled deliveries are paused. Has no effect on content serving. - Allowed values: `ACTIVE`, `INACTIVE` - `organizationId` (string, required) — ID of the organization this placement belongs to - `cadence` (Cadence, required) — Delivery cadence for the notification - `contentStrategyId` (string, optional) — ID of the content strategy linked to this placement, if any. Retained alongside `relationships.contentStrategy` for backward compatibility. ### EmailPlacementAttributes Attributes for an email placement - `name` (string, required) — Name of the placement - `status` (enum, required) — Whether the placement's scheduled deliveries are paused. Has no effect on content serving. - Allowed values: `ACTIVE`, `INACTIVE` - `organizationId` (string, required) — ID of the organization this placement belongs to - `availableSlots` (integer, required) — Number of available slots - `cadence` (Cadence, required) — Delivery cadence for the email - `contentStrategyId` (string, optional) — ID of the content strategy linked to this placement, if any. Retained alongside `relationships.contentStrategy` for backward compatibility. ### BatchActivationPlacementAttributes Attributes for a batch-activation placement. Slot detail is exposed via `relationships.slots` (resource identifiers) and the `batchActivationSlot` entries in `included`; request `?include=slots` (or a deeper path) to get the slot details. - `name` (string, required) — Name of the placement - `organizationId` (string, required) — ID of the organization this placement belongs to - `refreshInterval` (string, required) — ISO-8601 duration that controls how often the activation cohort refreshes (e.g. "P7D" for weekly). ### SlottedPlacementRelationships Relationship block for a batch-activation or group placement. - `slots` (ToManyRelationship, required) — Resource identifiers for the slots that make up the placement. Each entry corresponds to a `batchActivationSlot` resource that appears in `included` when the request asks for `slots` (or any deeper path that implies it). ### GroupPlacementAttributes Attributes for a group placement. A group is configured like a batch-activation placement but has no refreshInterval. Slot detail is exposed via `relationships.slots` (resource identifiers) and the `batchActivationSlot` entries in `included`; request `?include=slots` (or a deeper path) to get the slot details. - `name` (string, required) — Name of the placement - `organizationId` (string, required) — ID of the organization this placement belongs to ### ErrorObject - `status` (string, required) — Status code returned from the request - `title` (string, required) — Name of error - `detail` (string, required) — Description of the specific occurance of the error - `source` (ErrorSource, optional) — An object containing a reference to the primary source of the error - `id` (string, optional) — The id of the resource which caused the error. Always returned for multi-status errors. ### CreateStandardAttributes Attributes for creating a standard placement - `name` (string, required) — Name of the placement - `availableSlots` (integer, required) — Number of available slots (minimum 1) - `displayName` (string, optional) — Cardholder-facing title for the section (minimum 1 character). Omit to let clients use their default label. - `contentStrategyId` (string, optional) — ID of the content strategy to link this placement to ### CreatePushNotificationAttributes Attributes for creating a push-notification placement - `name` (string, required) — Name of the placement - `cadence` (Cadence, required) — Delivery cadence for the notification - `status` (enum, optional) — Placement status. Defaults to ACTIVE on create; when omitted on update, the current status is preserved. - Allowed values: `ACTIVE`, `INACTIVE` - `contentStrategyId` (string, optional) — ID of the content strategy to link this placement to ### CreateEmailAttributes Attributes for creating an email placement - `name` (string, required) — Name of the placement - `availableSlots` (integer, required) — Number of available slots (minimum 1) - `cadence` (Cadence, required) — Delivery cadence for the email - `status` (enum, optional) — Placement status. Defaults to ACTIVE on create; when omitted on update, the current status is preserved. - Allowed values: `ACTIVE`, `INACTIVE` - `contentStrategyId` (string, optional) — ID of the content strategy to link this placement to ### CreateBatchActivationAttributes Attributes for creating a batch-activation placement - `name` (string, required) — Name of the placement - `refreshInterval` (string, required) — ISO-8601 duration controlling how often the activation cohort refreshes - `slots` (list of CreateBatchActivationSlot, required) — Slots that make up the activation cohort ### CreateGroupAttributes Attributes for creating a group placement - `name` (string, required) — Name of the placement - `slots` (list of CreateBatchActivationSlot, required) — Slots that make up the group ### ToOneRelationship A JSON:API to-one relationship payload. - `data` (ResourceIdentifier, optional) — The linked resource identifier, or null when the relationship is present but unlinked. ### Cadence Cadence schedule for push notification and email placements - `frequency` (enum, required) — Delivery frequency - Allowed values: `DAILY`, `WEEKLY`, `MONTHLY` - `timeOfDay` (string, optional) — Optional time of day in HH:mm format (24-hour, UTC) - `dayOfWeek` (enum, optional) — Day of the week to deliver (used when frequency is WEEKLY, defaults to MON) - Allowed values: `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, `SUN` - `dayOfMonth` (integer, optional) — Day of the month to deliver, 1-31 (used when frequency is MONTHLY, defaults to 1) ### ToManyRelationship A JSON:API to-many relationship payload. - `data` (list of ResourceIdentifier, required) — The linked resource identifiers. ### ErrorSource - `pointer` (string, optional) — A JSON pointer to the value in the request document that caused the error - `parameter` (string, optional) — A string indicating which URI query parameter caused the error - `header` (string, optional) — A string indicating the name of a single request header which caused the error ### CreateBatchActivationSlot A slot in a batch-activation or group placement at creation time - `placementId` (string, required) — ID of another placement that fills this slot. The referenced placement provides both the content strategy and the limit on the number of offers available to the slot. - `alias` (string, required) — Customer-defined alias for the slot, unique within the placement - `shortDescription` (string, optional) — Optional short description of the slot, limited to 50 characters ### ResourceIdentifier A reference to another resource by type and id. - `type` (string, required) — Discriminant of the referenced resource (e.g. `contentStrategy`). - `id` (string, required) — Identifier of the referenced resource. ## Examples ### Create Placement **Request** ```json { "data": { "type": "placement", "attributes": { "name": "Homepage Banner", "availableSlots": 5 } } } ``` **Response** ```json { "type": "placement", "attributes": { "name": "Homepage Banner", "organizationId": "org-123", "availableSlots": 5 }, "id": "01961e5a-b74c-7d42-8456-d3a1f2c90e71" } ``` **SDK Code** ```python Create Placement import requests url = "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload = { "data": { "type": "placement", "attributes": { "name": "Homepage Banner", "availableSlots": 5 } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Create Placement const url = 'https://rewards-api.getkard.com/v2/issuers/org-123/placements'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"type":"placement","attributes":{"name":"Homepage Banner","availableSlots":5}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Create Placement package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload := strings.NewReader("{\n \"data\": {\n \"type\": \"placement\",\n \"attributes\": {\n \"name\": \"Homepage Banner\",\n \"availableSlots\": 5\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Create Placement require 'uri' require 'net/http' url = URI("https://rewards-api.getkard.com/v2/issuers/org-123/placements") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"type\": \"placement\",\n \"attributes\": {\n \"name\": \"Homepage Banner\",\n \"availableSlots\": 5\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Create Placement import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://rewards-api.getkard.com/v2/issuers/org-123/placements") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"type\": \"placement\",\n \"attributes\": {\n \"name\": \"Homepage Banner\",\n \"availableSlots\": 5\n }\n }\n}") .asString(); ``` ```php Create Placement request('POST', 'https://rewards-api.getkard.com/v2/issuers/org-123/placements', [ 'body' => '{ "data": { "type": "placement", "attributes": { "name": "Homepage Banner", "availableSlots": 5 } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Create Placement using RestSharp; var client = new RestClient("https://rewards-api.getkard.com/v2/issuers/org-123/placements"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"type\": \"placement\",\n \"attributes\": {\n \"name\": \"Homepage Banner\",\n \"availableSlots\": 5\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Create Placement import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": [ "type": "placement", "attributes": [ "name": "Homepage Banner", "availableSlots": 5 ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/v2/issuers/org-123/placements")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Create Push Notification Placement **Request** ```json { "data": { "type": "placementPushNotification", "attributes": { "name": "Daily Deal Alert", "cadence": { "frequency": "DAILY", "timeOfDay": "09:00" } } } } ``` **Response** ```json { "type": "placementPushNotification", "attributes": { "name": "Daily Deal Alert", "status": "ACTIVE", "organizationId": "org-123", "cadence": { "frequency": "DAILY", "timeOfDay": "09:00" } }, "id": "01961e5a-c83d-7a11-9b2e-e7f4a6d81b34" } ``` **SDK Code** ```python Create Push Notification Placement import requests url = "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload = { "data": { "type": "placementPushNotification", "attributes": { "name": "Daily Deal Alert", "cadence": { "frequency": "DAILY", "timeOfDay": "09:00" } } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Create Push Notification Placement const url = 'https://rewards-api.getkard.com/v2/issuers/org-123/placements'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"type":"placementPushNotification","attributes":{"name":"Daily Deal Alert","cadence":{"frequency":"DAILY","timeOfDay":"09:00"}}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Create Push Notification Placement package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload := strings.NewReader("{\n \"data\": {\n \"type\": \"placementPushNotification\",\n \"attributes\": {\n \"name\": \"Daily Deal Alert\",\n \"cadence\": {\n \"frequency\": \"DAILY\",\n \"timeOfDay\": \"09:00\"\n }\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Create Push Notification Placement require 'uri' require 'net/http' url = URI("https://rewards-api.getkard.com/v2/issuers/org-123/placements") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"type\": \"placementPushNotification\",\n \"attributes\": {\n \"name\": \"Daily Deal Alert\",\n \"cadence\": {\n \"frequency\": \"DAILY\",\n \"timeOfDay\": \"09:00\"\n }\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Create Push Notification Placement import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://rewards-api.getkard.com/v2/issuers/org-123/placements") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"type\": \"placementPushNotification\",\n \"attributes\": {\n \"name\": \"Daily Deal Alert\",\n \"cadence\": {\n \"frequency\": \"DAILY\",\n \"timeOfDay\": \"09:00\"\n }\n }\n }\n}") .asString(); ``` ```php Create Push Notification Placement request('POST', 'https://rewards-api.getkard.com/v2/issuers/org-123/placements', [ 'body' => '{ "data": { "type": "placementPushNotification", "attributes": { "name": "Daily Deal Alert", "cadence": { "frequency": "DAILY", "timeOfDay": "09:00" } } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Create Push Notification Placement using RestSharp; var client = new RestClient("https://rewards-api.getkard.com/v2/issuers/org-123/placements"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"type\": \"placementPushNotification\",\n \"attributes\": {\n \"name\": \"Daily Deal Alert\",\n \"cadence\": {\n \"frequency\": \"DAILY\",\n \"timeOfDay\": \"09:00\"\n }\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Create Push Notification Placement import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": [ "type": "placementPushNotification", "attributes": [ "name": "Daily Deal Alert", "cadence": [ "frequency": "DAILY", "timeOfDay": "09:00" ] ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/v2/issuers/org-123/placements")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Create Email Placement **Request** ```json { "data": { "type": "placementEmail", "attributes": { "name": "Weekly Deals Email", "availableSlots": 10, "cadence": { "frequency": "WEEKLY", "timeOfDay": "10:00", "dayOfWeek": "MON" } } } } ``` **Response** ```json { "type": "placementEmail", "attributes": { "name": "Weekly Deals Email", "status": "ACTIVE", "organizationId": "org-123", "availableSlots": 10, "cadence": { "frequency": "WEEKLY", "timeOfDay": "10:00", "dayOfWeek": "MON" } }, "id": "01961e5a-f37a-7b55-9d6a-2be8d1ac5f78" } ``` **SDK Code** ```python Create Email Placement import requests url = "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload = { "data": { "type": "placementEmail", "attributes": { "name": "Weekly Deals Email", "availableSlots": 10, "cadence": { "frequency": "WEEKLY", "timeOfDay": "10:00", "dayOfWeek": "MON" } } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Create Email Placement const url = 'https://rewards-api.getkard.com/v2/issuers/org-123/placements'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"type":"placementEmail","attributes":{"name":"Weekly Deals Email","availableSlots":10,"cadence":{"frequency":"WEEKLY","timeOfDay":"10:00","dayOfWeek":"MON"}}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Create Email Placement package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload := strings.NewReader("{\n \"data\": {\n \"type\": \"placementEmail\",\n \"attributes\": {\n \"name\": \"Weekly Deals Email\",\n \"availableSlots\": 10,\n \"cadence\": {\n \"frequency\": \"WEEKLY\",\n \"timeOfDay\": \"10:00\",\n \"dayOfWeek\": \"MON\"\n }\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Create Email Placement require 'uri' require 'net/http' url = URI("https://rewards-api.getkard.com/v2/issuers/org-123/placements") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"type\": \"placementEmail\",\n \"attributes\": {\n \"name\": \"Weekly Deals Email\",\n \"availableSlots\": 10,\n \"cadence\": {\n \"frequency\": \"WEEKLY\",\n \"timeOfDay\": \"10:00\",\n \"dayOfWeek\": \"MON\"\n }\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Create Email Placement import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://rewards-api.getkard.com/v2/issuers/org-123/placements") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"type\": \"placementEmail\",\n \"attributes\": {\n \"name\": \"Weekly Deals Email\",\n \"availableSlots\": 10,\n \"cadence\": {\n \"frequency\": \"WEEKLY\",\n \"timeOfDay\": \"10:00\",\n \"dayOfWeek\": \"MON\"\n }\n }\n }\n}") .asString(); ``` ```php Create Email Placement request('POST', 'https://rewards-api.getkard.com/v2/issuers/org-123/placements', [ 'body' => '{ "data": { "type": "placementEmail", "attributes": { "name": "Weekly Deals Email", "availableSlots": 10, "cadence": { "frequency": "WEEKLY", "timeOfDay": "10:00", "dayOfWeek": "MON" } } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Create Email Placement using RestSharp; var client = new RestClient("https://rewards-api.getkard.com/v2/issuers/org-123/placements"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"type\": \"placementEmail\",\n \"attributes\": {\n \"name\": \"Weekly Deals Email\",\n \"availableSlots\": 10,\n \"cadence\": {\n \"frequency\": \"WEEKLY\",\n \"timeOfDay\": \"10:00\",\n \"dayOfWeek\": \"MON\"\n }\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Create Email Placement import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": [ "type": "placementEmail", "attributes": [ "name": "Weekly Deals Email", "availableSlots": 10, "cadence": [ "frequency": "WEEKLY", "timeOfDay": "10:00", "dayOfWeek": "MON" ] ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/v2/issuers/org-123/placements")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Create Batch Activation Placement **Request** ```json { "data": { "type": "placementBatchActivation", "attributes": { "name": "Weekly Cohort", "refreshInterval": "P7D", "slots": [ { "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Featured deals refreshed each week" } ] } } } ``` **Response** ```json { "type": "placementBatchActivation", "attributes": { "name": "Weekly Cohort", "organizationId": "org-123", "refreshInterval": "P7D" }, "id": "01961e5a-d94e-7c22-ac3f-f8b5a7e92c45", "relationships": { "slots": { "data": [ { "type": "batchActivationSlot", "id": "01961e5a-e15f-7d33-bd4f-09c6b8fa3d56" } ] } } } ``` **SDK Code** ```python Create Batch Activation Placement import requests url = "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload = { "data": { "type": "placementBatchActivation", "attributes": { "name": "Weekly Cohort", "refreshInterval": "P7D", "slots": [ { "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Featured deals refreshed each week" } ] } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Create Batch Activation Placement const url = 'https://rewards-api.getkard.com/v2/issuers/org-123/placements'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"type":"placementBatchActivation","attributes":{"name":"Weekly Cohort","refreshInterval":"P7D","slots":[{"placementId":"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67","alias":"primary","shortDescription":"Featured deals refreshed each week"}]}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Create Batch Activation Placement package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload := strings.NewReader("{\n \"data\": {\n \"type\": \"placementBatchActivation\",\n \"attributes\": {\n \"name\": \"Weekly Cohort\",\n \"refreshInterval\": \"P7D\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Featured deals refreshed each week\"\n }\n ]\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Create Batch Activation Placement require 'uri' require 'net/http' url = URI("https://rewards-api.getkard.com/v2/issuers/org-123/placements") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"type\": \"placementBatchActivation\",\n \"attributes\": {\n \"name\": \"Weekly Cohort\",\n \"refreshInterval\": \"P7D\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Featured deals refreshed each week\"\n }\n ]\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Create Batch Activation Placement import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://rewards-api.getkard.com/v2/issuers/org-123/placements") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"type\": \"placementBatchActivation\",\n \"attributes\": {\n \"name\": \"Weekly Cohort\",\n \"refreshInterval\": \"P7D\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Featured deals refreshed each week\"\n }\n ]\n }\n }\n}") .asString(); ``` ```php Create Batch Activation Placement request('POST', 'https://rewards-api.getkard.com/v2/issuers/org-123/placements', [ 'body' => '{ "data": { "type": "placementBatchActivation", "attributes": { "name": "Weekly Cohort", "refreshInterval": "P7D", "slots": [ { "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Featured deals refreshed each week" } ] } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Create Batch Activation Placement using RestSharp; var client = new RestClient("https://rewards-api.getkard.com/v2/issuers/org-123/placements"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"type\": \"placementBatchActivation\",\n \"attributes\": {\n \"name\": \"Weekly Cohort\",\n \"refreshInterval\": \"P7D\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Featured deals refreshed each week\"\n }\n ]\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Create Batch Activation Placement import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": [ "type": "placementBatchActivation", "attributes": [ "name": "Weekly Cohort", "refreshInterval": "P7D", "slots": [ [ "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Featured deals refreshed each week" ] ] ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/v2/issuers/org-123/placements")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Create Group Placement **Request** ```json { "data": { "type": "placementGroup", "attributes": { "name": "Seasonal Collection", "slots": [ { "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Seasonal picks" } ] } } } ``` **Response** ```json { "type": "placementGroup", "attributes": { "name": "Seasonal Collection", "organizationId": "org-123" }, "id": "01961e5a-a48b-7e66-8c7b-3cf9e2bd6a89", "relationships": { "slots": { "data": [ { "type": "batchActivationSlot", "id": "01961e5a-b59c-7f77-9d8c-4d0af3ce7b9a" } ] } } } ``` **SDK Code** ```python Create Group Placement import requests url = "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload = { "data": { "type": "placementGroup", "attributes": { "name": "Seasonal Collection", "slots": [ { "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Seasonal picks" } ] } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Create Group Placement const url = 'https://rewards-api.getkard.com/v2/issuers/org-123/placements'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"type":"placementGroup","attributes":{"name":"Seasonal Collection","slots":[{"placementId":"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67","alias":"primary","shortDescription":"Seasonal picks"}]}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Create Group Placement package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://rewards-api.getkard.com/v2/issuers/org-123/placements" payload := strings.NewReader("{\n \"data\": {\n \"type\": \"placementGroup\",\n \"attributes\": {\n \"name\": \"Seasonal Collection\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Seasonal picks\"\n }\n ]\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Create Group Placement require 'uri' require 'net/http' url = URI("https://rewards-api.getkard.com/v2/issuers/org-123/placements") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"type\": \"placementGroup\",\n \"attributes\": {\n \"name\": \"Seasonal Collection\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Seasonal picks\"\n }\n ]\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Create Group Placement import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://rewards-api.getkard.com/v2/issuers/org-123/placements") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"type\": \"placementGroup\",\n \"attributes\": {\n \"name\": \"Seasonal Collection\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Seasonal picks\"\n }\n ]\n }\n }\n}") .asString(); ``` ```php Create Group Placement request('POST', 'https://rewards-api.getkard.com/v2/issuers/org-123/placements', [ 'body' => '{ "data": { "type": "placementGroup", "attributes": { "name": "Seasonal Collection", "slots": [ { "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Seasonal picks" } ] } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Create Group Placement using RestSharp; var client = new RestClient("https://rewards-api.getkard.com/v2/issuers/org-123/placements"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"type\": \"placementGroup\",\n \"attributes\": {\n \"name\": \"Seasonal Collection\",\n \"slots\": [\n {\n \"placementId\": \"01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67\",\n \"alias\": \"primary\",\n \"shortDescription\": \"Seasonal picks\"\n }\n ]\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Create Group Placement import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": [ "type": "placementGroup", "attributes": [ "name": "Seasonal Collection", "slots": [ [ "placementId": "01961e5a-f26f-7e44-ce5f-1ad7c9fb4e67", "alias": "primary", "shortDescription": "Seasonal picks" ] ] ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/v2/issuers/org-123/placements")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```