# Using external\_id via API

**URL:** <https://meta.discourse.org/t/using-external-id-via-api/252666>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [January 23, 2023, 9:23pm UTC](https://meta.discourse.org/t/using-external-id-via-api/252666 "2023-01-23T21:23:30Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![eg-gam](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@eg-gam](https://meta.discourse.org/u/eg-gam)\
**Post date:** [January 23, 2023, 9:23pm UTC](https://meta.discourse.org/t/using-external-id-via-api/252666/1 "2023-01-23T21:23:31Z")

</div>

Hello,

I’d like to create and retrieve a user via the API using an external\_id. The external\_id would be an integer that references an ID in our internal database. This is not SSO related.

I’m following the documentation but I can’t seem to get it to work. I can create the user but I cannot retrieve the user by external\_id. The Create User API just shows the request to have an external\_ids object but no more information on what the contents of the object should be. I searched the Community and only found [this topic](https://meta.discourse.org/t/api-create-user-external-ids-parameter/238470), but it wasn’t much help.

I’m trying to retrieve the user using the following GET request:

`https://our_domain.discourse.group/u/by-external/7000.json`

but it returns a 404 and the following response:

```json
{
    "errors": [
        "The requested URL or resource could not be found."
    ],
    "error_type": "not_found"
}

```

Following are examples of some of the Create User requests I’ve tried. The users are created successfully, I just can’t retrieve them by external\_id. (Side note: is there also a way to view the external\_id of a user?):

```json
{
    "name": "John",
    "username": "Doe",
    "email": "john.doe@example.com",
    "password": "Z44Di3AeD93KoRUyxpyE",
    "active": true,
    "approved": true,
    "external_id": 7000
}

```

```json
{
    "name": "John",
    "username": "Doe",
    "email": "john.doe@example.com",
    "password": "Z44Di3AeD93KoRUyxpyE",
    "active": true,
    "approved": true,
    "external_id": "7000"
}

```

```json
{
    "name": "John",
    "username": "Doe",
    "email": "john.doe@example.com",
    "password": "Z44Di3AeD93KoRUyxpyE",
    "active": true,
    "approved": true,
    "external_ids": {
        "external_id": 7000
    }
}

```

```json
{
    "name": "John",
    "username": "Doe",
    "email": "john.doe@example.com",
    "password": "Z44Di3AeD93KoRUyxpyE",
    "active": true,
    "approved": true,
    "external_ids": [
        7000
    ]
}

```

---

_[View the full topic](https://meta.discourse.org/t/using-external-id-via-api/252666)._
