# Triggering a backup via admin API causes the api\_key to become only valid for system user

**URL:** <https://meta.discourse.org/t/triggering-a-backup-via-admin-api-causes-the-api-key-to-become-only-valid-for-system-user/77858>\
**Category:** Bug\
**Created:** [January 12, 2018, 5:00pm UTC](https://meta.discourse.org/t/triggering-a-backup-via-admin-api-causes-the-api-key-to-become-only-valid-for-system-user/77858 "2018-01-12T17:00:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [January 15, 2018, 4:23pm UTC](https://meta.discourse.org/t/triggering-a-backup-via-admin-api-causes-the-api-key-to-become-only-valid-for-system-user/77858/3 "2018-01-15T16:23:57Z")

</div>

### Before

```plaintext
[4] pry(main)> ApiKey.all
  ApiKey Load (0.4ms) SELECT "api_keys".* FROM "api_keys"
=> [#<ApiKey:0x0000000d615e38
  id: 3,
  key: "scoobydoowhereareyou",
  user_id: nil,
  created_by_id: -1,
  created_at: Mon, 15 Jan 2018 16:20:10 UTC +00:00,
  updated_at: Mon, 15 Jan 2018 16:20:10 UTC +00:00,
  allowed_ips: nil,
  hidden: false>]

```

### Operation

```plaintext
○ → curl -XPOST -H 'Content-Type: application/json' \
  "http://discoursedev:3000/admin/backups.json?api_key=scoobydoowhereareyou&api_username=michael" \
  -d '{ "with_uploads": true }'
{"success":"OK"}

```

### After

```plaintext
[5] pry(main)> ApiKey.all
  ApiKey Load (0.3ms) SELECT "api_keys".* FROM "api_keys"
=> [#<ApiKey:0x000000064318d0
  id: 3,
  key: "scoobydoowhereareyou",
  user_id: -1,
  created_by_id: -1,
  created_at: Mon, 15 Jan 2018 16:20:10 UTC +00:00,
  updated_at: Mon, 15 Jan 2018 16:20:31 UTC +00:00,
  allowed_ips: nil,
  hidden: false>]

```

---

_[View the full topic](https://meta.discourse.org/t/triggering-a-backup-via-admin-api-causes-the-api-key-to-become-only-valid-for-system-user/77858)._
