# No description in a category via API

**URL:** https://meta.discourse.org/t/no-description-in-a-category-via-api/277473
**Category:** Migration
**Tags:** rest-api
**Created:** [September 1, 2023, 8:58am UTC](https://meta.discourse.org/t/no-description-in-a-category-via-api/277473 "2023-09-01T08:58:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![FLucas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/flucas/32/317231_2.png) [@FLucas](https://meta.discourse.org/u/FLucas)
#### Post date: [September 1, 2023, 8:58am UTC](https://meta.discourse.org/t/no-description-in-a-category-via-api/277473/1 "2023-09-01T08:58:09Z")

</div>

Hi,

I’m still importing data from an old app into our new Discourse.  
I can’t create a category with its description with the following API call :

```plaintext
curl -X POST "https://site-discourse/categories.json" \
-H "Api-Key: api-key" \
-H "Api-Username: api-username" \
-d "name=categorie test" \
-d "description=Description De La Categorie"

```

The category is created but there is no description.

I get the following response:

```plaintext
{"category":{"id":21,"name":"categorie test",[...],"slug":"categorie-test", [...] **,"description":null** ,"description_text":null,"description_excerpt":null,"topic_url":"/t/a-propos-de-la-categorie-categorie-test/12286", [...]

```

Thanks for your help

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [September 1, 2023, 9:05am UTC](https://meta.discourse.org/t/no-description-in-a-category-via-api/277473/2 "2023-09-01T09:05:52Z")

</div>

Hi :blob_wave:

The description of a category is the content of the automatically created “About” topic. The default text is probably considered “null” until it’s edited.

I think there’s no available “description” parameter in the request to create a category, and you need to make another API request to update the first post of the About topic.

Depending on your importing process, you might want to use a proper import script instead of using the API. See #Support > Migration

---

<div class="post-metadata">

### Author: ![FLucas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/flucas/32/317231_2.png) [@FLucas](https://meta.discourse.org/u/FLucas)
#### Post date: [September 1, 2023, 4:49pm UTC](https://meta.discourse.org/t/no-description-in-a-category-via-api/277473/3 "2023-09-01T16:49:54Z")

</div>

Thank you for your reply

I created this script allowing you to create a category and then modify its description:

```bash
curl -X POST "https://site-discourse/categories.json" \
 -H "Api-Key: api-key" \
 -H "Api-Username: api-username" \
 -d "name=Catégorie 1"
 
sleep 2 
 
latest_posts_response=$(curl -X GET "https://site-discourse/posts.json" \
 -H "Content-Type: application/json" \
 -H "Api-Key: api-key" \
 -H "Api-Username: api-username") 
                 
post_id=$(echo $latest_posts_response | jq '.latest_posts[0] .id')
   
curl -X PUT "https://site-discourse/posts/$post_id.json" \
 -H "Content-Type: application/json" \
 -H "Api-Key: api-key" \
 -H "Api-Username: api-username" \
 -d '{
        "post": {
        "raw": "Description de la catégorie 1"
      }
     }'

```

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [September 1, 2023, 5:59pm UTC](https://meta.discourse.org/t/no-description-in-a-category-via-api/277473/4 "2023-09-01T17:59:50Z")

</div>

Did it work in the end?

---

<div class="post-metadata">

### Author: ![FLucas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/flucas/32/317231_2.png) [@FLucas](https://meta.discourse.org/u/FLucas)
#### Post date: [September 4, 2023, 4:00pm UTC](https://meta.discourse.org/t/no-description-in-a-category-via-api/277473/5 "2023-09-04T16:00:39Z")

</div>

Yes thank you it works !
