Answers.Body: <p>You can't create a csv directly from an API call. But it would be a very simple task to make an API call and then format the results as a csv. One simple option might be to use Google Apps Script to call the API then put the results into a spreadsheet, if you don't want to run this as a standalone script. Or any scripting language you might want to use will have plenty of Google results for creating a csv from an array, which is what the API will return.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-17T10:44:42.203Z
Answers.Text: That's great idea, thanks!
Answers.UserDisplayName: Rucc
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-16T03:15:49.063Z
Answers.LastActivityDate: 2021-03-16T03:15:49.063Z
Answers.UserDisplayName: Lars SG
Body: <p>How can I make a REST API call to Civi that creates a CSV file with all the Contacts details (name, email, telephone...) from an specified Smart Group?</p>
  <p>Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-23T15:51:57.820Z
Comments.Text: The REST api isn't capable of making a CSV, it can easily get you the members from the group but formatting those into a CSV is coding you would have to undertake in your code/system and is beyond the scope of CiviCRM. I'll post an answer with an example API call. EDIT The "review" screen helpfully doesn't show the comment which basically says what I said :-)
Comments.UserDisplayName: HomoTechsual
Tags: <contacts><api><groups><rest>
Title: Export CSV of an smart group's contacts via REST API?
ThreadText: # Export CSV of an smart group's contacts via REST API?
  
  (Asked by: username_0 on 2021-03-12)
  
  How can I make a REST API call to Civi that creates a CSV file with all the Contacts details (name, email, telephone...) from an specified Smart Group?
  
  Thanks.
  
  **Tags:** contacts, api, groups, rest
  
  > **Comments:**
  > **username_1**: The REST api isn't capable of making a CSV, it can easily get you the members from the group but formatting those into a CSV is coding you would have to undertake in your code/system and is beyond the scope of CiviCRM. I'll post an answer with an example API call. EDIT The "review" screen helpfully doesn't show the comment which basically says what I said :-)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-03-16. Score: 1 | Accepted answer
  
  You can't create a csv directly from an API call. But it would be a very simple task to make an API call and then format the results as a csv. One simple option might be to use Google Apps Script to call the API then put the results into a spreadsheet, if you don't want to run this as a standalone script. Or any scripting language you might want to use will have plenty of Google results for creating a csv from an array, which is what the API will return.
  
  > **Comments:**
  > **username_0**: That's great idea, thanks!  
  
  ---
  
  