--- title: "Samsung DSP GraphQL API examples v3" slug: "samsung-dsp-graphql-api-examples" updated: 2023-09-01T18:41:28Z published: 2023-09-01T18:41:28Z canonical: "help.dsp.samsungads.com/samsung-dsp-graphql-api-examples" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.dsp.samsungads.com/llms.txt > Use this file to discover all available pages before exploring further. # Samsung DSP GraphQL API examples ## Initial setup & documentation Generate your API Key: [API Documentation](/docs/api-documentation) The official interactive documentation is located here: [https://dsp.samsungads.com/api/graphql/doc](https://dsp.samsungads.com/api/graphql/doc). You can see the documentation by clicking on the Docs link on the right (if the panel is collapsed). This will open the interactive documentation where you can click on item to see more details. ![](https://cdn.document360.io/287afab9-a086-4024-a782-6cbdb167f005/Images/Documentation/image-B2K3G2GP.png?sv=2026-02-06&spr=https&st=2026-11-17T00%3A33%3A00Z&se=2026-11-17T01%3A33%3A00Z&sr=b&sp=r&sig=yBCaYSTjEd6MA6NE32mTT3I%2FaUbP8WR4cHMDJpKV518%3D) The API uses GraphQL query language. Find the official documentation on the GraphQL query language on [the GraphQL site.](https://graphql.org/) ## Examples using cURL [cURL](https://curl.haxx.se/) is an open source command line tool and library for transferring data with URL syntax. ### Upload files In the example below, simply replace `__AUTH_TOKEN__` with your Samsung DSP API Key and `__FILE__` with the file path to the file you want to upload. ```graphql curl -X POST -H 'Content-Type: multipart/form-data' -F "asset=@__FILE__" 'https://dsp.samsungads.com/api/v2/uploads?auth_token=__AUTH_TOKEN__' ``` Once successful, you will get this as a response. Example of a response from the uploads endpoint, when uploading the file *300x250.png* ```json {  "id": 123456,  "user_id": 25,  "asset": {    "url": "http://cdn.adgrx.com/uploads/M5/FX6t_Q8dotyPsNf2Vvlw/300x250.png"  },  "url": "http://cdn.adgrx.com/uploads/M5/FX6t_Q8dotyPsNf2Vvlw/300x250.png",  "file_name": "300x250.png",  "content_type": "image/png",  "file_size": 25919,  "meta": {    "width": 300,    "height": 250  },  "created_at": "2021-01-07T23:29:15-05:00",  "updated_at": "2021-01-07T23:29:15-05:00" } ``` The important part is the id, which is the upload ID that you will need to include in the GraphQL query. ### Queries (Get Data) In the example below, replace `__AUTH_TOKEN__` with your Samsung DSP API Key and `__QUERY_HERE__` with the actual GraphQL query. ```graphql curl -X POST -H 'Authorization: Bearer __AUTH_TOKEN__' -H 'Content-Type: application/json' --data '{ "query": "__QUERY_HERE__" }' 'https://dsp.samsungads.com/api/graphql' ``` #### CURL example with a file With cURL, you can also send a file with the data instead of having it all in the command. In the example below, replace `__AUTH_TOKEN__` with your Samsung DSP API Key and `__FILE_HERE__` with the JSON file. ```graphql curl -X POST -H 'Authorization: Bearer __AUTH_TOKEN__' -H 'Content-Type: application/json' -d@__FILE_HERE__ 'https://dsp.samsungads.com/api/graphql' ``` #### Creatives In the example below, replace `__CREATIVE_ID__` with your Samsung DSP creative ID or a list of creative IDs, separated by commas. Each creative type might contains different fields so you can include those fields in an [inline fragment](https://graphql.org/learn/queries/#inline-fragments). **Image** GraphQL query to get one or multiple creatives data from Samsung DSP ```graphql {  creatives(filter: "id IN (__CREATIVE_ID__)") {    data {      name      type      ... on CreativesImage {        adchoices_position        image_file {          file_name        }      }      audits {        audit_type        state        latest_feedback      }    }  } } ``` **Image and video in the same query** GraphQL query to get one or multiple creatives data from Samsung DSP, with fields from the Image creative type and Video creative type. ```graphql {  creatives(filter: "id IN (__CREATIVE_ID_1__,__CREATIVE_ID_2__)") {    data {      name      type      ... on CreativesVideo {        adchoices_position        original_file {          file_name        }      }      ... on CreativesImage {        adchoices_position        image_file {          file_name        }      }      audits {        audit_type        state        latest_feedback      }    }  } } ``` Note that the examples above only show a subset of the available fields for creatives. Please check the interactive documentation for more info on which fields are available (and how to include them in your GraphQL query) ### Mutations (Push Data) Mutation are used when you want to create or update elements. In cases where you need to upload files, you will need to upload the files first, get their resulting upload id and include that ID in the GraphQL mutation (see [Upload files](/v1/docs/samsung-dsp-graphql-api-examples#upload-files)). #### Creatives In the example below, replace `__ADVERTISER_ID__` with the [advertiser ID](https://dsp.samsungads.com/advertisers), `__FORMAT_ID__` with the format ID and `__FILE_UPLOAD_ID__` with the upload ID from the output you got when you uploaded the file in the previous step (see [Upload files](/v1/docs/samsung-dsp-graphql-api-examples#upload-files)). **Create an image** GraphQL query ```graphql mutation CreateImageCreative($creative_obj: SaveCreativesImageInput!){  create_image_creative(input: $creative_obj) {    data_with_errors { id errors { full_messages } }    success  } } ``` GraphQL variables Here’s the minimal information you need to provide to create an image creatives. ```graphql {  "creative_obj": {    "name": "My creative name",    "advertiser_id": __ADVERTISER_ID__,    "format_id": __FORMAT_ID__,    "image_file_upload_id": __FILE_UPLOAD_ID__,    "click_destination_url": "https://www.samsungads.com",    "declared_destination_url": "https://www.samsungads.com"  } } ``` The `image_file_upload_id` comes from the output you got when you uploaded the file in the previous step (see [Upload files](/v1/docs/samsung-dsp-graphql-api-examples#upload-files)). #### Lists Replace `__FILE_UPLOAD_ID__` with the file upload ID comes from the output you got when you uploaded the file in the previous step (see [Upload files](/v1/docs/samsung-dsp-graphql-api-examples#upload-files)). Replace `__LIST_ID__` with the [list ID](https://dsp.samsungads.com/iplists) you want to edit. **Create an IP list** GraphQL query ```graphql mutation CreateIPList($list_obj: SaveIplistInput!) {  create_iplist(input: $list_obj) {    data {id count}    errors { has_errors full_messages }    success  } } ``` GraphQL variables ```graphql {  "list_obj": {    "name": "My list name",    "upload_id": __FILE_UPLOAD_ID__,    "force_deploy": false  } } ``` The `upload_id` comes from the output you got when you uploaded the file in the previous step (see [Upload files](/v1/docs/samsung-dsp-graphql-api-examples#upload-files)). **Update an existing IP list** GraphQL query ```graphql mutation UpdateIPList($list_obj: SaveIplistInput!, $list_id: Int!) {  update_iplist(input: $list_obj, id: $list_id) {    data {id count}    errors { has_errors full_messages }    success  } } ``` GraphQL variables Here’s the minimal information you need to provide to create an image creatives. ```graphql {  "list_obj": {    "name": "My list name",    "upload_id": __FILE_UPLOAD_ID__,    "force_deploy": false  },  "list_id": __LIST_ID__ } ``` The `upload_id` comes from the output you got when you uploaded the file in the previous step (see [Upload files](/v1/docs/samsung-dsp-graphql-api-examples#upload-files)) #### Samsung DSP Standard Segments Replace `__ID__` with the [segment ID](https://dsp.samsungads.com/segments) you want to edit. **Create a segment with an expiry of 15 days** Graph QL query ```graphql mutation CreateStandardSegment($input: StandardSegmentInput!) {  create_standard_segment(input: $input) {    data {      id      name      ttl    }    errors {      has_errors      full_messages    }    success  } } ``` GraphQL variables Here’s the minimal information you need to provide to create an image creatives ```graphql {  "input": {    "name": "My Segment Name",    "description": "Segment description",    "ttl": 1296000  } } ``` **Update an existing segment** GraphQL query ```graphql mutation UpdateStandardSegment($input: StandardSegmentInput!, $id: Int!) {  update_standard_segment(input: $input, id: $id) {    data {id name ttl}    errors { has_errors full_messages }    success  } } ``` GraphQL variables Here’s the minimal information you need to provide to create an image creatives. ```graphql {  "input": {    "name": "My New Segment Name",    "description": "New Segment description",    "ttl": 1296000  },  "id": __ID__ } ``` #### Step by Step example with Smart TV list upload **Create a new Smart TV list** 1. Upload your list: Replace `__AUTH_TOKEN__` with your Samsung DSP API Key and `__FILE__` with the file path to the file you want to upload. ```graphql curl -X POST \  -H 'Content-Type: multipart/form-data' \  -F "asset=@my_filename.csv" \  'https://dsp.samsungads.com/api/v2/uploads?auth_token=__AUTH_TOKEN__' ``` 2. Get the **Upload ID** from the output ```graphql {  "id": 123456,  "user_id": 25,  "asset": {    "url": "http://cdn.adgrx.com/uploads/M5/FX6t_Q8dotyPsNf2Vvlw/300x250.png"  },  "url": "http://cdn.adgrx.com/uploads/M5/FX6t_Q8dotyPsNf2Vvlw/300x250.png",  "file_name": "300x250.png",  "content_type": "image/png",  "file_size": 25919,  "meta": {    "width": 300,    "height": 250  },  "created_at": "2021-01-07T23:29:15-05:00",  "updated_at": "2021-01-07T23:29:15-05:00" } ``` 3. **Create** the new list: Replace `__AUTH_TOKEN__` with your Samsung DSP API Key and `__FILE_UPLOAD_ID__` with the upload ID from the output you got when you uploaded the file in the previous step ```graphql curl -X POST \  -H 'Authorization: Bearer __AUTH_TOKEN__' \  -H 'Content-Type: application/json' \  --data '{ "query": "mutation CreateSTVList($list_obj: SaveStvlistInput!) {create_stvlist(input: $list_obj) {data {id count} errors { has_errors full_messages } success}}", "variables": "{\"list_obj\":{\"name\":\"My Smart TV List\", \"upload_id\":__FILE_UPLOAD_ID__, \"source\":\"samsung_ads\", \"force_deploy\": false, \"use_device_graph\":false}}" }' \  'https://dsp.samsungads.com/api/graphql' ```